Class: ExpandRuby::Trans
- Inherits:
-
Object
- Object
- ExpandRuby::Trans
- Defined in:
- lib/re_expand/Node.rb
Instance Attribute Summary collapse
-
#dest ⇒ Object
readonly
Returns the value of attribute dest.
-
#pat ⇒ Object
readonly
Returns the value of attribute pat.
Instance Method Summary collapse
- #arg ⇒ Object
-
#initialize(pat, dest) ⇒ Trans
constructor
A new instance of Trans.
- #str ⇒ Object
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
#dest ⇒ Object (readonly)
Returns the value of attribute dest.
21 22 23 |
# File 'lib/re_expand/Node.rb', line 21 def dest @dest end |
#pat ⇒ Object (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
#arg ⇒ Object
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 |
#str ⇒ Object
23 24 25 |
# File 'lib/re_expand/Node.rb', line 23 def str @pat.split(/\t/)[0].to_s end |