Class: PIC::Template

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#picObject (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_reObject 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