noesya/osuny

View on GitHub
app/services/contact_details/base.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
92%
class ContactDetails::Base
  attr_accessor :value, :label

  def initialize(string)
    @string = string.to_s
    return if @string.blank?
    prepare_value
    prepare_label
  end

  def present?
    value.present?
  end

  protected

  def prepare_value
    @value = @string.dup
  end

  def prepare_label
    @label = @string.dup
  end
end