lib/language/output.rb in language-ruby-1.0.1 vs lib/language/output.rb in language-ruby-1.1.0

- old
+ new

@@ -24,16 +24,12 @@ def empty? case @raw when NilClass true - when String + when String, Array, Hash raw.empty? - when Array - raw.empty? - when Hash - raw.empty? end end def to_raw if raw.is_a?(Array) @@ -65,14 +61,12 @@ raw.inspect end def []=(key, value) case @raw - when NilClass + when NilClass, String @raw = { key => value } - when String - @raw = { key => value } when Array @raw << Output.new({ key => value }) when Hash @raw[key] = value end @@ -84,14 +78,12 @@ @raw = other.raw when String case other.raw when String @raw += other.raw - when Array + when Array, Hash @raw = other.raw - when Hash - @raw = other.raw end when Array case other.raw when String nil @@ -100,46 +92,36 @@ when Hash @raw << other end when Hash case other.raw - when String + when String, Array nil - when Array - nil when Hash @raw.merge!(other.raw) end end end def <<(other) case @raw when NilClass case other.raw - when String + when String, Array, Hash @raw = [other] - when Array - @raw = [other] - when Hash - @raw = [other] end when String case other.raw when String @raw += other.raw - when Array + when Array, Hash @raw = [other] - when Hash - @raw = [other] end when Array @raw << other when Hash case other.raw - when String - nil - when Array + when String, Array nil when Hash @raw.merge!(other.raw) end end