Class: Moceansdk::Modules::Command::McBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/moceansdk/modules/command/mc_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeMcBuilder

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

#buildObject



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