Class: Nuri::Compiler
- Inherits:
-
Object
- Object
- Nuri::Compiler
- Defined in:
- lib/nuric.rb
Overview
Ruby wrapper for Nuri language compiler.
Instance Method Summary collapse
-
#compile(opts) ⇒ Object
:file => file that contains the specification :string => string of specification.
- #nuric ⇒ Object
-
#plan(opts) ⇒ Object
:type => :file | :string :init => initial state specification (filename or string) :goal => goal state specification (filename or string).
Instance Method Details
#compile(opts) ⇒ Object
:file => file that contains the specification :string => string of specification
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/nuric.rb', line 13 def compile(opts) lib = (opts[:lib] ? opts[:lib] : '.') if opts[:file] compile_file opts[:file], lib elsif opts[:string] compile_string opts[:string], lib end rescue raise 'Invalid input.' end |
#nuric ⇒ Object
7 8 9 |
# File 'lib/nuric.rb', line 7 def nuric @nuric ||= "#{home}/share/#{platform}/nuric" end |
#plan(opts) ⇒ Object
:type => :file | :string :init => initial state specification (filename or string) :goal => goal state specification (filename or string)
27 28 29 30 31 32 33 34 35 |
# File 'lib/nuric.rb', line 27 def plan(opts) lib = (opts[:lib] ? opts[:lib] : '.') case opts[:type] when :file plan_files opts[:init], opts[:goal], lib when :string plan_strings opts[:init], opts[:goal], lib end end |