Class: Diograph::Diory
- Inherits:
-
Object
- Object
- Diograph::Diory
- Defined in:
- lib/diograph/diory.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#background ⇒ Object
readonly
Returns the value of attribute background.
-
#connected_diories ⇒ Object
Returns the value of attribute connected_diories.
-
#connections ⇒ Object
readonly
Returns the value of attribute connections.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#diory_id ⇒ Object
readonly
Returns the value of attribute diory_id.
-
#diory_type ⇒ Object
readonly
Returns the value of attribute diory_type.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#modified ⇒ Object
readonly
Returns the value of attribute modified.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#room ⇒ Object
readonly
Returns the value of attribute room.
Instance Method Summary collapse
- #connect_to(to_diory) ⇒ Object
-
#initialize(args = {}) ⇒ Diory
constructor
A new instance of Diory.
Constructor Details
#initialize(args = {}) ⇒ Diory
Returns a new instance of Diory.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/diograph/diory.rb', line 8 def initialize(args={}) @diory_id = args[:diory_id] || args[:ID] @name = args[:name] @diory_type = args[:diory_type] @date = args[:date] @address = args[:address] @background = args[:background] @latitude = args[:latitude] @longitude = args[:longitude] @created = args[:created] @modified = args[:modified] @room = args[:room] @room.diories << self if @room @connections = args[:connections] || [] @connected_diories = args[:connected_diories] || [] end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
5 6 7 |
# File 'lib/diograph/diory.rb', line 5 def address @address end |
#background ⇒ Object (readonly)
Returns the value of attribute background.
5 6 7 |
# File 'lib/diograph/diory.rb', line 5 def background @background end |
#connected_diories ⇒ Object
Returns the value of attribute connected_diories.
6 7 8 |
# File 'lib/diograph/diory.rb', line 6 def connected_diories @connected_diories end |
#connections ⇒ Object (readonly)
Returns the value of attribute connections.
6 7 8 |
# File 'lib/diograph/diory.rb', line 6 def connections @connections end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
5 6 7 |
# File 'lib/diograph/diory.rb', line 5 def created @created end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
5 6 7 |
# File 'lib/diograph/diory.rb', line 5 def date @date end |
#diory_id ⇒ Object (readonly)
Returns the value of attribute diory_id.
5 6 7 |
# File 'lib/diograph/diory.rb', line 5 def diory_id @diory_id end |
#diory_type ⇒ Object (readonly)
Returns the value of attribute diory_type.
5 6 7 |
# File 'lib/diograph/diory.rb', line 5 def diory_type @diory_type end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
5 6 7 |
# File 'lib/diograph/diory.rb', line 5 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
5 6 7 |
# File 'lib/diograph/diory.rb', line 5 def longitude @longitude end |
#modified ⇒ Object (readonly)
Returns the value of attribute modified.
5 6 7 |
# File 'lib/diograph/diory.rb', line 5 def modified @modified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/diograph/diory.rb', line 5 def name @name end |
#room ⇒ Object (readonly)
Returns the value of attribute room.
6 7 8 |
# File 'lib/diograph/diory.rb', line 6 def room @room end |
Instance Method Details
#connect_to(to_diory) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/diograph/diory.rb', line 27 def connect_to(to_diory) connection = Connection.new(from_diory: self, to_diory: to_diory) @connections << connection @connected_diories << to_diory to_diory.connections << connection to_diory.connected_diories << self end |