Class: ExpandRuby::Trans

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pat, dest) ⇒ Trans

Returns a new instance of Trans.



15
16
17
18
19
# File 'lib/re_expand/Node.rb', line 15

def initialize(pat,dest)
  # pat にマッチしたら dest に遷移
  @pat = pat
  @dest = dest
end

Instance Attribute Details

#destObject (readonly)

Returns the value of attribute dest.



21
22
23
# File 'lib/re_expand/Node.rb', line 21

def dest
  @dest
end

#patObject (readonly)

Returns the value of attribute pat.



21
22
23
# File 'lib/re_expand/Node.rb', line 21

def pat
  @pat
end

Instance Method Details

#argObject



27
28
29
30
31
32
33
# File 'lib/re_expand/Node.rb', line 27

def arg
  if @pat =~ /^(.*)\t(.*)$/ then
    return $2
  else
    return @pat
  end
end

#strObject



23
24
25
# File 'lib/re_expand/Node.rb', line 23

def str
  @pat.split(/\t/)[0].to_s
end