Class: Action
- Inherits:
-
Object
- Object
- Action
- Defined in:
- lib/cisco-deviot/thing.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#need_payload ⇒ Object
readonly
Returns the value of attribute need_payload.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
Instance Method Summary collapse
- #add_parameter(parameter) ⇒ Object
- #get_model ⇒ Object
-
#initialize(name, need_payload = false) ⇒ Action
constructor
A new instance of Action.
Constructor Details
#initialize(name, need_payload = false) ⇒ Action
Returns a new instance of Action.
63 64 65 66 67 |
# File 'lib/cisco-deviot/thing.rb', line 63 def initialize(name, need_payload = false) @name = name @parameters = [] @need_payload = need_payload end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
59 60 61 |
# File 'lib/cisco-deviot/thing.rb', line 59 def name @name end |
#need_payload ⇒ Object (readonly)
Returns the value of attribute need_payload.
61 62 63 |
# File 'lib/cisco-deviot/thing.rb', line 61 def need_payload @need_payload end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
60 61 62 |
# File 'lib/cisco-deviot/thing.rb', line 60 def parameters @parameters end |
Instance Method Details
#add_parameter(parameter) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/cisco-deviot/thing.rb', line 69 def add_parameter(parameter) if parameter.instance_of? String @parameters.push(Property.new(parameter)) return self end if parameter.instance_of? Property @parameters.push(parameter) return self end raise ArgumentError end |
#get_model ⇒ Object
81 82 83 |
# File 'lib/cisco-deviot/thing.rb', line 81 def get_model {name: @name, parameters: @parameters.collect {|p| p.get_model}} end |