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).



175
176
177
178
179
180
181
182
183
# File 'lib/ruote/reader/ruby_dsl.rb', line 175

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)


164
165
166
167
168
169
# File 'lib/ruote/reader/ruby_dsl.rb', line 164

def self.understands?(s)

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