Class: Pocolog::Upgrade::Ops::ContainerCast

Inherits:
Base
  • Object
show all
Defined in:
lib/pocolog/upgrade/ops/container_cast.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#to_type

Instance Method Summary collapse

Methods inherited from Base

#convert, #identity?

Constructor Details

#initialize(to_type, element_ops) ⇒ ContainerCast

Returns a new instance of ContainerCast



7
8
9
10
# File 'lib/pocolog/upgrade/ops/container_cast.rb', line 7

def initialize(to_type, element_ops)
    super(to_type)
    @element_ops = element_ops
end

Instance Attribute Details

#element_opsObject (readonly)

Returns the value of attribute element_ops



5
6
7
# File 'lib/pocolog/upgrade/ops/container_cast.rb', line 5

def element_ops
  @element_ops
end

Instance Method Details

#call(target, value) ⇒ Object



12
13
14
15
16
# File 'lib/pocolog/upgrade/ops/container_cast.rb', line 12

def call(target, value)
    value.raw_each do |sample|
        target.push(element_ops.convert(sample))
    end
end