Module: CEML
- Extended by:
- CEML
- Included in:
- CEML
- Defined in:
- lib/ceml.rb,
lib/ceml.rb,
lib/ceml/role.rb,
lib/ceml/driver.rb,
lib/ceml/script.rb,
lib/ceml/incident.rb,
lib/ceml/confluence.rb,
lib/ceml/casting_statement.rb,
lib/ceml/instruction_statements.rb
Defined Under Namespace
Modules: CastingStatement, InstructionStatements, Script
Classes: Confluence, Criteria, Driver, Incident, Role
Instance Method Summary
collapse
Instance Method Details
#clock ⇒ Object
20
|
# File 'lib/ceml.rb', line 20
def clock; Time.now.utc.to_i + @extra_seconds; end
|
#incr_clock(s) ⇒ Object
21
|
# File 'lib/ceml.rb', line 21
def incr_clock(s); @extra_seconds += s; end
|
#parse(what, string) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/ceml.rb', line 25
def parse(what, string)
string = string.dup
string.gsub!(/\n +/, ' ')
what = case what
when :script then :free_script
when :scripts then :free_scripts
else what
end
result = nil
ScriptsParser.new.tap do |parser|
result = parser.parse(string, :root => what)
raise "parse failed: \n#{parser.failure_reason}" unless result
case what
when :free_scripts
raise "no scripts found" unless result.scripts.list
result = result.scripts.list
result.each{ |s| s.validate! }
when :free_script
result = result.script
result.validate!
end
end
result
end
|