Class: Worlds::Components::Component
- Inherits:
-
Object
- Object
- Worlds::Components::Component
- Defined in:
- lib/worlds/components/component.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
Returns the value of attribute commands.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
Instance Method Summary collapse
-
#initialize(entity, commands: []) ⇒ Component
constructor
A new instance of Component.
- #invoke ⇒ Object
- #select ⇒ Object
- #select_heading ⇒ Object
- #select_options ⇒ Object
- #update(ms) ⇒ Object
Constructor Details
#initialize(entity, commands: []) ⇒ Component
Returns a new instance of Component.
7 8 9 10 |
# File 'lib/worlds/components/component.rb', line 7 def initialize(entity, commands: []) @owner = entity @commands = commands end |
Instance Attribute Details
#commands ⇒ Object
Returns the value of attribute commands.
5 6 7 |
# File 'lib/worlds/components/component.rb', line 5 def commands @commands end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
4 5 6 |
# File 'lib/worlds/components/component.rb', line 4 def owner @owner end |
Instance Method Details
#invoke ⇒ Object
30 31 |
# File 'lib/worlds/components/component.rb', line 30 def invoke end |
#select ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/worlds/components/component.rb', line 20 def select return nil unless .any? { type: :select, heading: select_heading, options: .map(&:to_s), } end |
#select_heading ⇒ Object
12 13 14 |
# File 'lib/worlds/components/component.rb', line 12 def select_heading "Select an option:" end |
#select_options ⇒ Object
16 17 18 |
# File 'lib/worlds/components/component.rb', line 16 def [] end |
#update(ms) ⇒ Object
33 34 |
# File 'lib/worlds/components/component.rb', line 33 def update(ms) end |