Class: Resyma::Core::RegexpSomething

Inherits:
Regexp
  • Object
show all
Defined in:
lib/resyma/core/automaton/regexp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Regexp

#to_automaton

Constructor Details

#initialize(matchable) ⇒ RegexpSomething

Matches what the matchable matches

Parameters:



125
126
127
# File 'lib/resyma/core/automaton/regexp.rb', line 125

def initialize(matchable)
  @condition = matchable
end

Instance Attribute Details

#conditionObject (readonly)

Returns the value of attribute condition.



129
130
131
# File 'lib/resyma/core/automaton/regexp.rb', line 129

def condition
  @condition
end

Instance Method Details

#==(other) ⇒ Object



131
132
133
# File 'lib/resyma/core/automaton/regexp.rb', line 131

def ==(other)
  other.is_a?(self.class) && other.condition == @condition
end

#inject(ab, start_state) ⇒ Object



135
136
137
138
139
# File 'lib/resyma/core/automaton/regexp.rb', line 135

def inject(ab, start_state)
  accept = ab.new_state!
  ab.add_transition!(start_state, @condition, accept)
  accept
end