Module: Ruote::RubyReader

Defined in:
lib/ruote/reader/ruby_dsl.rb

Overview

The same .read and .understands? method as the other readers are found here.

Class Method Summary collapse

Class Method Details

.read(s, treechecker) ⇒ Object

Evaluates the ruby string in the code, but at fist, thanks to the treechecker, makes sure it doesn't code malicious ruby code (at least tries very hard).


179
180
181
182
183
184
185
186
187
# File 'lib/ruote/reader/ruby_dsl.rb', line 179

def self.read(s, treechecker)

  treechecker.definition_check(s)
  eval(s)

rescue SyntaxError => se
  #p se
  raise ArgumentError.new("Ruby syntax error : #{se.message}")
end

.understands?(s) ⇒ Boolean

Returns true if s seems to contain a Ruby process definition

Returns:

  • (Boolean)

168
169
170
171
172
173
# File 'lib/ruote/reader/ruby_dsl.rb', line 168

def self.understands?(s)

  s.match(
    /\bRuote\.(process_definition|workflow_definition|define)\b/
  ) != nil
end