lib/grumlin/typing.rb in grumlin-1.0.0.rc5 vs lib/grumlin/typing.rb in grumlin-1.0.0.rc6
- old
+ new
@@ -18,14 +18,16 @@
"g:TraversalMetrics" => ->(value) { cast_map(value[:@value]) },
"g:Metrics" => ->(value) { cast_map(value[:@value]) },
"g:T" => ->(value) { Grumlin::Expressions::T.public_send(value) }
}.freeze
- CASTABLE_TYPES = [Hash, String, Integer, TrueClass, FalseClass, NilClass].freeze
+ CASTABLE_TYPES = [Hash, String, Integer, TrueClass, FalseClass, NilClass, Array].freeze
class << self
def cast(value)
verify_type!(value)
+
+ return value.map { |v| cast(v) } if value.is_a?(Array)
return value unless value.is_a?(Hash)
type = TYPES[value[:@type]]