Sha256: d3cc3756f402119084edb36e56cbfd771cf3bf97fe16230b8067d6d0d7a089da
Contents?: true
Size: 1.06 KB
Versions: 16
Compression:
Stored size: 1.06 KB
Contents
module Eco module Common class MetaThor class Value KEY = "MetaThorValue" KEY_OPTION = "MetaThorJSON" class << self def to_value(doc) case when doc.is_a?(Hash) case when doc.key?(KEY_OPTION) to_value(doc[KEY_OPTION]) when doc.key?(KEY) doc[KEY] else doc end when doc.is_a?(String) to_value(JSON.parse(doc)) when doc.is_a?(Value) value.value end end def key?(object) end end attr_reader :value def initialize(value) @doc = {"#{KEY}" => value} end def value @doc[KEY] end def as_input_option "--#{INPUT_OPTION}=#{KEY_OPTION}:#{@doc.to_json}" end def as_option {"#{INPUT_SYM}" => self} end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems