Class: Location::Finder::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/location/finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cityObject

Returns the value of attribute city.



38
39
40
# File 'lib/location/finder.rb', line 38

def city
  @city
end

#complementObject

Returns the value of attribute complement.



37
38
39
# File 'lib/location/finder.rb', line 37

def complement
  @complement
end

#districtObject

Returns the value of attribute district.



38
39
40
# File 'lib/location/finder.rb', line 38

def district
  @district
end

#numberObject

Returns the value of attribute number.



37
38
39
# File 'lib/location/finder.rb', line 37

def number
  @number
end

#postal_codeObject

Returns the value of attribute postal_code.



36
37
38
# File 'lib/location/finder.rb', line 36

def postal_code
  @postal_code
end

#stateObject

Returns the value of attribute state.



38
39
40
# File 'lib/location/finder.rb', line 38

def state
  @state
end

#streetObject

Returns the value of attribute street.



37
38
39
# File 'lib/location/finder.rb', line 37

def street
  @street
end

#typeObject

Returns the value of attribute type.



36
37
38
# File 'lib/location/finder.rb', line 36

def type
  @type
end

Instance Method Details

#to_hash(options = {}) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/location/finder.rb', line 50

def to_hash(options = {})
  attributes = instance_variables.map do |k|
    k.to_s.gsub(/^@/, '').to_sym
  end

  only = Array(options[:only] || attributes).map!(&:to_sym)

  attributes.each_with_object({}) do |k, a|
    a[k] = send(k) if only.include?(k)
  end
end