Class: Source2MD::RegexpBuilder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegexpBuilder

Returns a new instance of RegexpBuilder.



6
7
8
9
10
11
# File 'lib/source2md/regexp_builder.rb', line 6

def initialize
  update do |e|
    e.prefix_re  = %r{^\s*}
    e.comment_re = %r{#|//}
  end
end

Instance Attribute Details

#comment_reObject

Returns the value of attribute comment_re.



4
5
6
# File 'lib/source2md/regexp_builder.rb', line 4

def comment_re
  @comment_re
end

#prefix_reObject

Returns the value of attribute prefix_re.



3
4
5
# File 'lib/source2md/regexp_builder.rb', line 3

def prefix_re
  @prefix_re
end

Instance Method Details

#meta_reObject



18
19
20
# File 'lib/source2md/regexp_builder.rb', line 18

def meta_re
  @meta_re ||= %r{#{prefix_re}(?:#{comment_re})}
end

#stdout_reObject



22
23
24
# File 'lib/source2md/regexp_builder.rb', line 22

def stdout_re
  @stdout_re ||= %r{^(?:#{comment_re}) >>.*$}
end

#update {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



13
14
15
16
# File 'lib/source2md/regexp_builder.rb', line 13

def update(&block)
  yield self
  reset
end