Sha256: b004e40630872da6674fae2df391cf53a71cf6d140d4633c48a3194719d2dbe4
Contents?: true
Size: 646 Bytes
Versions: 3
Compression:
Stored size: 646 Bytes
Contents
# frozen_string_literal: true module Basic101 class BasicObject def self.type_name name.split('::').last.gsub(/^Basic/, '').downcase end def type_name self.class.type_name end def eval(runtime) self end def to_numeric raise TypeError, "#{type_name} cannot be converted to numeric" end def to_integer raise TypeError, "#{type_name} cannot be converted to integer" end def to_float raise TypeError, "#{type_name} cannot be converted to float" end def to_string raise TypeError, "#{type_name} cannot be converted to string" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
basic101-1.0.2 | lib/basic101/basic_object.rb |
basic101-1.0.1 | lib/basic101/basic_object.rb |
basic101-1.0.0 | lib/basic101/basic_object.rb |