Class: RX
- Inherits:
-
Object
- Object
- RX
- Defined in:
- lib/rx.rb
Overview
Regex string builder
Instance Attribute Summary collapse
-
#final_reg ⇒ Object
readonly
Returns the value of attribute final_reg.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#final_reg ⇒ Object (readonly)
Returns the value of attribute final_reg.
5 6 7 |
# File 'lib/rx.rb', line 5 def final_reg @final_reg end |
Class Method Details
.new {|instance| ... } ⇒ Object
7 8 9 10 11 12 |
# File 'lib/rx.rb', line 7 def self.new instance = allocate yield instance instance end |
Instance Method Details
#_final_reg ⇒ Object
36 37 38 39 40 41 |
# File 'lib/rx.rb', line 36 def _final_reg start = @start[0] - 1 final = @finals[0] - 1 lang = @steps["l#{@steps.size - 1}"] @final_reg = lang[start][final] end |
#build(states, delta_star, start, finals) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/rx.rb', line 14 def build(states, delta_star, start, finals) @states = states @delta_star = delta_star @start = start @finals = finals @empty = "\u2205" _to_reg end |
#print_matrix ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rx.rb', line 23 def print_matrix @steps.each do |key, value| puts key value.transpose.each do |column| column.each do |element| printf("\t|%-#{value.map { |c| c.max_by(&:length).length }.max}s", element) end puts '|' end end _final_reg end |