class GreenMonster::Decoder
Public Class Methods
new(schema)
click to toggle source
初期化
# File lib/green_monster/decoder.rb, line 4 def initialize(schema) @schema = schema end
Public Instance Methods
convert(row, &block)
click to toggle source
変換
# File lib/green_monster/decoder.rb, line 9 def convert(row, &block) attrs = {} @schema.attributes.each do |attribute| attrs.update( attribute.name => attribute.decode(fetch_value(row[attribute.options[:col_num]])) ) end block.call(attrs) if block_given? attrs end
Private Instance Methods
fetch_value(data)
click to toggle source
使用するデータを抽出する
# File lib/green_monster/decoder.rb, line 24 def fetch_value(data) data end