Class: Hope::Statement
- Extended by:
- Forwardable
- Defined in:
- lib/hope/statement.rb
Instance Attribute Summary collapse
-
#ep_statement ⇒ Object
readonly
Returns the value of attribute ep_statement.
Instance Method Summary collapse
-
#initialize(ep_statement) ⇒ Statement
constructor
A new instance of Statement.
- #serializable_hash ⇒ Object
- #to_json ⇒ Object
- #to_s ⇒ Object
- #updated_at ⇒ Object
Constructor Details
#initialize(ep_statement) ⇒ Statement
Returns a new instance of Statement.
45 46 47 |
# File 'lib/hope/statement.rb', line 45 def initialize ep_statement @ep_statement = ep_statement end |
Instance Attribute Details
#ep_statement ⇒ Object (readonly)
Returns the value of attribute ep_statement.
15 16 17 |
# File 'lib/hope/statement.rb', line 15 def ep_statement @ep_statement end |
Instance Method Details
#serializable_hash ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/hope/statement.rb', line 53 def serializable_hash { :id => name, :name => name, :text => text, :updated_at => updated_at, :state => state.to_s, :is_pattern => pattern?, :event_type => event_type.getName, :is_destroyed => destroyed?, :listeners => get_listeners.map { |l| l.serializable_hash } } end |
#to_json ⇒ Object
67 68 69 |
# File 'lib/hope/statement.rb', line 67 def to_json serializable_hash.to_json end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/hope/statement.rb', line 41 def to_s "[#{name}:#{event_type}] (#{state}) : #{text}" end |
#updated_at ⇒ Object
49 50 51 |
# File 'lib/hope/statement.rb', line 49 def updated_at Time.at(@ep_statement.getTimeLastStateChange / 1000) end |