Parent

Class/Module Index [+]

Quicksearch

Ruote::Exp::FlowExpression::HandlerEntry

Used by on_error when patterns are involved. Gathers much of the pattern logic…

Attributes

action[R]
child_id[R]
pattern[R]

Public Class Methods

new(on_error_entry) click to toggle source
# File lib/ruote/exp/ro_on_x.rb, line 113
def initialize(on_error_entry)

  if on_error_entry.is_a?(Hash)
    on_error_entry = on_error_entry.to_a.flatten
  end

  @pattern, @action, @child_id = on_error_entry
  @pat = Ruote.regex_or_s(@pattern) || //
end

Public Instance Methods

match(regex_or_err) click to toggle source
# File lib/ruote/exp/ro_on_x.rb, line 128
def match(regex_or_err)

  if regex_or_err.is_a?(Regexp)
    @action.match(regex_or_err)
  else
    @pat.match(regex_or_err['message']) ||
    @pat.match(regex_or_err['class'])
  end
end
narrow() click to toggle source
# File lib/ruote/exp/ro_on_x.rb, line 138
def narrow

  @action.is_a?(Array) ? @action : self
end
split(pat) click to toggle source
# File lib/ruote/exp/ro_on_x.rb, line 123
def split(pat)

  @action.split(pat)
end
update_tree(tree, retries) click to toggle source
# File lib/ruote/exp/ro_on_x.rb, line 143
def update_tree(tree, retries)

  child = tree[2][@child_id]

  if @pattern
    if retries.empty?
      child[1].delete(@pattern)
    else
      child[1][@pattern] = retries.join(', ')
    end
  else
    key, _ = child[1].find { |k, v| v.nil? }
    child[1].delete(key)
    child[1][retries.join(', ')] = nil if retries.any?
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.