Module: RplLang::Words::Program
Instance Method Summary collapse
Methods included from Types
Instance Method Details
#populate_dictionary ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rpl/words/program.rb', line 8 def populate_dictionary super @dictionary.add_word( ['eval'], 'Program', '( a -- … ) interpret', proc do args = stack_extract( [:any] ) if [RplList, RplNumeric, RplBoolean].include?( args[0].class ) @stack << args[0] # these types evaluate to themselves else run( args[0].value.to_s ) end end ) end |