Class: Rewrite::ByExample::LiteralEntity

Inherits:
SexpEntity show all
Defined in:
lib/rewrite/by_example/literal_entity.rb

Instance Attribute Summary

Attributes inherited from SexpEntity

#sequence

Attributes inherited from EntityMatcher

#predicate

Instance Method Summary collapse

Methods inherited from SexpEntity

#fold, for_sequence, proc_capturer, #to_s, #unfold

Methods inherited from EntityMatcher

#after_unfold, #fold, #such_that!, #unfold

Constructor Details

#initialize(name = Rewrite.gensym) ⇒ LiteralEntity

Returns a new instance of LiteralEntity.



13
14
15
16
17
18
19
# File 'lib/rewrite/by_example/literal_entity.rb', line 13

def initialize(name = Rewrite.gensym)
  super()
  self.sequence = Composition.new(
    LengthOne.new(ObjectToMatcher.from_object(:lit)),
    LengthOne.new(Bind.new(name, AnyEntity.new))
  )
end