Class: Patm::Rule::Compiled

Inherits:
Object
  • Object
show all
Defined in:
lib/patm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(src_body, context) ⇒ Compiled

Returns a new instance of Compiled.



607
608
609
610
611
612
613
614
615
616
617
618
619
620
# File 'lib/patm.rb', line 607

def initialize(src_body, context)
  @src_body = src_body
  @context = context
  @src = <<-RUBY
  def apply(_obj, _self = nil)
    _ctx = @context
    _match = {}
#{@src_body}
  end
  RUBY

  singleton_class = class <<self; self; end
  singleton_class.class_eval(@src)
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



623
624
625
# File 'lib/patm.rb', line 623

def context
  @context
end

#src_bodyObject (readonly)

Returns the value of attribute src_body.



622
623
624
# File 'lib/patm.rb', line 622

def src_body
  @src_body
end