Class: Goodcheck::Pattern::Regexp
- Inherits:
-
Object
- Object
- Goodcheck::Pattern::Regexp
- Defined in:
- lib/goodcheck/pattern.rb
Instance Attribute Summary collapse
-
#case_sensitive ⇒ Object
readonly
Returns the value of attribute case_sensitive.
-
#multiline ⇒ Object
readonly
Returns the value of attribute multiline.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(source:, case_sensitive:, multiline:, regexp: nil) ⇒ Regexp
constructor
A new instance of Regexp.
- #regexp ⇒ Object
Constructor Details
#initialize(source:, case_sensitive:, multiline:, regexp: nil) ⇒ Regexp
Returns a new instance of Regexp.
22 23 24 25 26 27 |
# File 'lib/goodcheck/pattern.rb', line 22 def initialize(source:, case_sensitive:, multiline:, regexp: nil) @source = source @case_sensitive = case_sensitive @multiline = multiline @regexp = regexp end |
Instance Attribute Details
#case_sensitive ⇒ Object (readonly)
Returns the value of attribute case_sensitive.
19 20 21 |
# File 'lib/goodcheck/pattern.rb', line 19 def case_sensitive @case_sensitive end |
#multiline ⇒ Object (readonly)
Returns the value of attribute multiline.
20 21 22 |
# File 'lib/goodcheck/pattern.rb', line 20 def multiline @multiline end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
18 19 20 |
# File 'lib/goodcheck/pattern.rb', line 18 def source @source end |
Instance Method Details
#regexp ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/goodcheck/pattern.rb', line 29 def regexp @regexp ||= begin = 0 |= ::Regexp::IGNORECASE unless case_sensitive |= ::Regexp::MULTILINE if multiline ::Regexp.compile(source, ) end end |