Class: Moceansdk::Modules::Command::McBuilder
- Inherits:
-
Object
- Object
- Moceansdk::Modules::Command::McBuilder
- Defined in:
- lib/moceansdk/modules/command/mc_builder.rb
Instance Method Summary collapse
- #add(mc) ⇒ Object
- #build ⇒ Object
-
#initialize ⇒ McBuilder
constructor
A new instance of McBuilder.
Constructor Details
#initialize ⇒ McBuilder
Returns a new instance of McBuilder.
6 7 8 |
# File 'lib/moceansdk/modules/command/mc_builder.rb', line 6 def initialize @mc = [] end |
Instance Method Details
#add(mc) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/moceansdk/modules/command/mc_builder.rb', line 10 def add(mc) unless mc.is_a? McObject::AbstractMc raise Moceansdk::Exceptions::MoceanError, 'mc_object must extend AbstractMc' end @mc.push(mc) self end |
#build ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/moceansdk/modules/command/mc_builder.rb', line 19 def build converted = [] @mc.each do |mc| converted.push(mc.get_request_data) end converted end |