rpl.rb/lib/rpl/types.rb

22 lines
470 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'rpl/types/boolean'
require 'rpl/types/name'
require 'rpl/types/list'
require 'rpl/types/string'
require 'rpl/types/program'
require 'rpl/types/numeric'
2022-08-31 11:10:33 +02:00
require 'rpl/types/complex'
2022-02-28 11:40:47 +01:00
module Types
module_function
2022-02-28 11:40:47 +01:00
def new_object( type_class, value )
if type_class.can_parse?( value )
type_class.new( value )
else
RplString.new( "\"Error: cannot create #{type_class} with value #{value}\"" )
end
end
end