Sha256: 8a47798e61c868b992a40c7a28600eccffc31b9f9a04792c740f9da6f47ea646
Contents?: true
Size: 1004 Bytes
Versions: 2
Compression:
Stored size: 1004 Bytes
Contents
module Transcriber class Resource module Parser module Property def parse(item, resource = nil) value = digg(item) translate(serializer.serialize(value), resource) end def digg(input) input_path.inject(input) {|buffer, key| buffer = buffer[key]} end def translate(value, resource) case translations when nil then value when Hash then translations[value] when Proc then resource.instance_eval(&translations) end end def from_hash(value) value end def to_input(value, options = {}) input = {} path = input_path if path.any? last = path.pop key_input = path.inject(input) {|buffer, key| buffer[key] = {}; buffer[key]} key_input[last] = value else input.merge!(value) end input end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
transcriber-0.0.19 | lib/transcriber/resource/parser/property.rb |
transcriber-0.0.18 | lib/transcriber/resource/parser/property.rb |