Class: Lucid::Runtime::Facade

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/lucid/runtime/facade.rb

Overview

This is what a programming language will consider to be a runtime.

It’s a thin class that directs the specific methods needed by the programming languages to the right place.

Instance Method Summary collapse

Constructor Details

#initialize(orchestrator, interface) ⇒ Facade

Returns a new instance of Facade.



12
13
14
# File 'lib/lucid/runtime/facade.rb', line 12

def initialize(orchestrator, interface)
  @orchestrator, @interface = orchestrator, interface
end

Instance Method Details

#doc_string(string_without_triple_quotes, content_type = '', line_offset = 0) ⇒ Object

Returns AST::DocString



53
54
55
# File 'lib/lucid/runtime/facade.rb', line 53

def doc_string(string_without_triple_quotes, content_type='', line_offset=0)
  AST::DocString.new(string_without_triple_quotes,content_type)
end

#table(text_or_table, file = nil, line_offset = 0) ⇒ Object

Returns a Lucid::AST::Table which can either be a String:

table(%{
  | study   | phase  |
  | Test-01 | I      |
  | Test-02 | II     |
})

or a 2D Array:

table([
  %w{ study phase },
  %w{ Test-01 I },
  %w{ Test-02 II }
])


44
45
46
47
48
49
50
# File 'lib/lucid/runtime/facade.rb', line 44

def table(text_or_table, file=nil, line_offset=0)
  if Array === text_or_table
    AST::Table.new(text_or_table)
  else
    AST::Table.parse(text_or_table, file, line_offset)
  end
end