Class: Machiawase::Rendezvous
- Inherits:
-
Object
- Object
- Machiawase::Rendezvous
- Defined in:
- lib/machiawase/rendezvous.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#lat ⇒ Object
readonly
Returns the value of attribute lat.
-
#lon ⇒ Object
readonly
Returns the value of attribute lon.
-
#near_station ⇒ Object
readonly
Returns the value of attribute near_station.
-
#place ⇒ Place
readonly
The place to rendezvous.
-
#places ⇒ Array<Place>
readonly
The array of given places.
Instance Method Summary collapse
-
#initialize(*places) ⇒ Rendezvous
constructor
A new instance of Rendezvous.
-
#to_h ⇒ Hash
The attributes with Hash format.
-
#to_json ⇒ JSON
The attributes with JSON format.
- #to_msgpack ⇒ Object
Constructor Details
#initialize(*places) ⇒ Rendezvous
Returns a new instance of Rendezvous.
16 17 18 19 |
# File 'lib/machiawase/rendezvous.rb', line 16 def initialize(*places) @place = nil @places = places end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
13 14 15 |
# File 'lib/machiawase/rendezvous.rb', line 13 def address @address end |
#lat ⇒ Object (readonly)
Returns the value of attribute lat.
13 14 15 |
# File 'lib/machiawase/rendezvous.rb', line 13 def lat @lat end |
#lon ⇒ Object (readonly)
Returns the value of attribute lon.
13 14 15 |
# File 'lib/machiawase/rendezvous.rb', line 13 def lon @lon end |
#near_station ⇒ Object (readonly)
Returns the value of attribute near_station.
13 14 15 |
# File 'lib/machiawase/rendezvous.rb', line 13 def near_station @near_station end |
#place ⇒ Place (readonly)
Returns the place to rendezvous.
13 14 15 |
# File 'lib/machiawase/rendezvous.rb', line 13 def place @place end |
#places ⇒ Array<Place> (readonly)
Returns the array of given places.
13 |
# File 'lib/machiawase/rendezvous.rb', line 13 attr_reader :place, :places, :lat, :lon, :address, :near_station |
Instance Method Details
#to_h ⇒ Hash
Returns the attributes with Hash format.
46 47 48 49 50 51 52 53 54 |
# File 'lib/machiawase/rendezvous.rb', line 46 def to_h h = Hash.new @places.each_with_index do |place, i| h.store("place#{i}", place.to_h) end @place ||= middle_of(*@places) h.store("machiawase", @place.to_h) end |
#to_json ⇒ JSON
Returns the attributes with JSON format.
57 58 59 |
# File 'lib/machiawase/rendezvous.rb', line 57 def to_json JSON.pretty_generate(to_h) end |
#to_msgpack ⇒ Object
61 62 63 |
# File 'lib/machiawase/rendezvous.rb', line 61 def to_msgpack to_h.to_msgpack end |