Top Level Namespace

Defined Under Namespace

Modules: ApiHelper, ApplicationHelper, MifParserUtils Classes: Act, ActMention, ActPart, ActReferenceParser, ActResolver, ActSection, ActToHtmlParser, ActsController, Amendment, AmendmentToClause, AmendmentToSchedule, ApiController, ApplicationController, Bill, Effect, EpubParser, ExplanatoryNote, ExplanatoryNotesFile, ExplanatoryNotesParser, ExternalReferenceResolver, MifFile, MifTableParser, MifToHtmlParser, NewClause, NewSchedule, NoteByClause, NoteBySchedule, NoteRangeByClause, SessionNumber, Sponsor, Version

Instance Method Summary collapse

Instance Method Details

#line_regexp_i(pattern) ⇒ Object


17
18
19
# File 'lib/regexp_generator.rb', line 17

def line_regexp_i pattern
  regexp('\A' + pattern + '\Z', 'i')
end

#ogsub(text, regexp, replacement) ⇒ Object


29
30
31
32
33
34
35
# File 'lib/regexp_generator.rb', line 29

def ogsub text, regexp, replacement
  if Miffy::use_oniguruma
    regexp.gsub(text, replacement)
  else
    text.gsub(regexp, replacement)
  end
end

#ogsub!(text, regexp, replacement) ⇒ Object


21
22
23
24
25
26
27
# File 'lib/regexp_generator.rb', line 21

def ogsub! text, regexp, replacement
  if Miffy::use_oniguruma
    regexp.gsub!(text, replacement)
  else
    text.gsub!(regexp, replacement)
  end
end

#osub!(text, regexp, replacement) ⇒ Object


37
38
39
40
41
42
43
# File 'lib/regexp_generator.rb', line 37

def osub! text, regexp, replacement
  if Miffy::use_oniguruma
    regexp.sub!(text, replacement)
  else
    text.sub!(regexp, replacement)
  end
end

#regexp(pattern, option = nil, encoding = 'utf8') ⇒ Object


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/regexp_generator.rb', line 1

def regexp pattern, option=nil, encoding='utf8'
  if Miffy::use_oniguruma
    Oniguruma::ORegexp.new(pattern, option, encoding)
  else
    if option
      if option == 'i'
        /#{pattern}/i
      else
        raise 'regexp option is un-handled: ' + option
      end
    else
      /#{pattern}/
    end
  end
end