Class: PIC::Template
- Inherits:
-
Object
- Object
- PIC::Template
- Defined in:
- lib/pic.rb
Instance Attribute Summary collapse
-
#pic ⇒ Object
readonly
Returns the value of attribute pic.
Instance Method Summary collapse
- #=~(string) ⇒ Object
-
#initialize(pic) ⇒ Template
constructor
A new instance of Template.
- #to_re ⇒ Object (also: #to_regexp)
Constructor Details
#initialize(pic) ⇒ Template
Returns a new instance of Template.
12 13 14 |
# File 'lib/pic.rb', line 12 def initialize(pic) @pic = pic end |
Instance Attribute Details
#pic ⇒ Object (readonly)
Returns the value of attribute pic.
17 18 19 |
# File 'lib/pic.rb', line 17 def pic @pic end |
Instance Method Details
#=~(string) ⇒ Object
32 33 34 |
# File 'lib/pic.rb', line 32 def =~(string) to_re =~ string end |
#to_re ⇒ Object Also known as: to_regexp
20 21 22 23 24 25 26 |
# File 'lib/pic.rb', line 20 def to_re re = '' pic.scan(SCAN) do |s,c| re << remap(s) + recnt(c) end Regexp.new(re) end |