Class: IParty::MaxMind::Result::Subdivisions

Inherits:
Array
  • Object
show all
Defined in:
lib/iparty/max_mind/result.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Subdivisions

Returns a new instance of Subdivisions.



106
107
108
# File 'lib/iparty/max_mind/result.rb', line 106

def initialize raw
  super((raw || []).map{|hash| Subdivision.new(hash) })
end

Instance Method Details

#inspectObject



110
111
112
# File 'lib/iparty/max_mind/result.rb', line 110

def inspect
  "#<#{self.class}:#{format("0x%x", object_id << 1)}: #{super}>"
end

#least_specificObject



124
125
126
# File 'lib/iparty/max_mind/result.rb', line 124

def least_specific
  first || Subdivision.new
end

#most_specificObject



128
129
130
# File 'lib/iparty/max_mind/result.rb', line 128

def most_specific
  last || Subdivision.new
end

#presenceObject



120
121
122
# File 'lib/iparty/max_mind/result.rb', line 120

def presence
  self if present?
end

#present?Boolean

Returns:

  • (Boolean)


116
117
118
# File 'lib/iparty/max_mind/result.rb', line 116

def present?
  !empty?
end