Class: Inform::Ephemeral::Link
- Defined in:
- lib/story_teller/inform/ephemeral/link.rb
Overview
The Inform::Ephemeral::Link class
Constant Summary collapse
- LinkTemplate =
'%<link_name>s -> %<to_name>s [%<to_identity>s]'.freeze
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#from ⇒ Object
Returns the value of attribute from.
-
#modified_at ⇒ Object
Returns the value of attribute modified_at.
-
#name ⇒ Object
Returns the value of attribute name.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #after_save ⇒ Object
- #before_create ⇒ Object
-
#initialize(properties) ⇒ Link
constructor
A new instance of Link.
- #save ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(properties) ⇒ Link
Returns a new instance of Link.
33 34 35 36 37 38 39 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 33 def initialize(properties) super() before_create @name = properties[:name] @to = properties[:to] @from = properties[:from] end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
31 32 33 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 31 def created_at @created_at end |
#from ⇒ Object
Returns the value of attribute from.
31 32 33 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 31 def from @from end |
#modified_at ⇒ Object
Returns the value of attribute modified_at.
31 32 33 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 31 def modified_at @modified_at end |
#name ⇒ Object
Returns the value of attribute name.
31 32 33 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 31 def name @name end |
#to ⇒ Object
Returns the value of attribute to.
31 32 33 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 31 def to @to end |
Instance Method Details
#<=>(other) ⇒ Object
57 58 59 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 57 def <=>(other) self.name <=> other.name end |
#after_save ⇒ Object
49 50 51 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 49 def after_save self.modified_at = Time.now.utc end |
#before_create ⇒ Object
41 42 43 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 41 def before_create self.created_at ||= Time.now end |
#save ⇒ Object
45 46 47 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 45 def save after_save end |
#to_s ⇒ Object
53 54 55 |
# File 'lib/story_teller/inform/ephemeral/link.rb', line 53 def to_s format(LinkTemplate, link_name: name, to_name: to.name, to_identity: to.identity) end |