Class: CloudRailSi::ServiceCode::MakeLimitedStream

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudrail_si/servicecode/commands/stream/MakeLimitedStream.rb

Instance Method Summary collapse

Instance Method Details

#execute(environment, parameters) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/cloudrail_si/servicecode/commands/stream/MakeLimitedStream.rb', line 11

def execute(environment, parameters)
    Helper.assert(parameters.length == 3 &&
                  Helper.is_var_address(parameters[0]))
    result_var = parameters[0]
    source = Helper.resolve(environment, parameters[1])
    limit = Helper.resolve(environment, parameters[2])
    Helper.assert(Helper.is_stream(source) && Helper.is_number(limit))
    res_stream = LimitedReadableStream.new(source, limit)
    environment.set_variable(result_var, res_stream)
end

#get_identifierObject



7
8
9
# File 'lib/cloudrail_si/servicecode/commands/stream/MakeLimitedStream.rb', line 7

def get_identifier
    'stream.makeLimitedStream'
end