class Regexador::Transform::Node
Public Class Methods
make(*fields, &block)
click to toggle source
# File lib/regexador_xform.rb, line 7 def self.make(*fields, &block) klass = ::Class.new(self) do fields.each {|field| attr_accessor field } define_method(:fields) { fields.dup } define_method(:to_s, &block) end klass end
new(*values)
click to toggle source
# File lib/regexador_xform.rb, line 16 def initialize *values fields.zip(values) {|f,v| self.send("#{f}=", v) } end
Public Instance Methods
inspect()
click to toggle source
# File lib/regexador_xform.rb, line 34 def inspect data = fields.map {|f| "#{f}=#{self.send(f).inspect}" }.join(', ') short_name + "(" + data + ")" end
short_name()
click to toggle source
# File lib/regexador_xform.rb, line 29 def short_name str = self.class.name str[str.rindex('::')+2..-1] end
to_s()
click to toggle source
# File lib/regexador_xform.rb, line 20 def to_s raise NotImplementedError, "Please implement #to_s for #{short_name}." end
to_str()
click to toggle source
# File lib/regexador_xform.rb, line 25 def to_str to_s end