lib/grumlin/typing.rb in grumlin-1.0.0 vs lib/grumlin/typing.rb in grumlin-1.0.1
- old
+ new
@@ -15,11 +15,12 @@
"g:Double" => ->(value) { cast_double(value) },
"g:Direction" => ->(value) { value.to_sym },
"g:VertexProperty" => ->(value) { cast_entity(Grumlin::VertexProperty, value) },
"g:TraversalMetrics" => ->(value) { cast_map(value[:@value]) },
"g:Metrics" => ->(value) { cast_map(value[:@value]) },
- "g:T" => ->(value) { Grumlin::Expressions::T.public_send(value) }
+ "g:T" => ->(value) { Grumlin::Expressions::T.public_send(value) },
+ "g:UUID" => ->(value) { value }
}.freeze
CASTABLE_TYPES = [Hash, String, Integer, TrueClass, FalseClass, NilClass, Array].freeze
class << self
@@ -43,10 +44,10 @@
raise TypeError, "#{value.inspect} cannot be casted" unless CASTABLE_TYPES.include?(value.class)
end
def verify_castable_hash!(value, type)
raise TypeError, "#{value} cannot be casted, @type is missing" if value[:@type].nil?
- raise(UnknownTypeError, value[:@type]) if type.nil?
+ raise(Grumlin::UnknownTypeError, value[:@type]) if type.nil?
raise TypeError, "#{value} cannot be casted, @value is missing" if value[:@value].nil?
end
def cast_int(value)
raise TypeError, "#{value} is not an Integer" unless value.is_a?(Integer)