lib/grumlin/typing.rb in grumlin-0.7.0 vs lib/grumlin/typing.rb in grumlin-0.8.0
- old
+ new
@@ -29,22 +29,13 @@
verify_castable_hash!(value, type)
type.call(value[:@value])
end
- def to_bytecode(step)
- {
- "@type": "g:Bytecode",
- "@value": { step: step }
- }
- end
-
private
- def castable_type?(value); end
-
def verify_type!(value)
- raise TypeError, "#{value.inspect} cannot be casted" unless CASTABLE_TYPES.any? { |t| value.is_a?(t) }
+ 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?