Class: Goodcheck::Pattern::Literal
- Inherits:
-
Object
- Object
- Goodcheck::Pattern::Literal
- Defined in:
- lib/goodcheck/pattern.rb
Instance Attribute Summary collapse
-
#case_sensitive ⇒ Object
readonly
Returns the value of attribute case_sensitive.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(source:, case_sensitive:) ⇒ Literal
constructor
A new instance of Literal.
- #regexp ⇒ Object
Constructor Details
#initialize(source:, case_sensitive:) ⇒ Literal
Returns a new instance of Literal.
7 8 9 10 |
# File 'lib/goodcheck/pattern.rb', line 7 def initialize(source:, case_sensitive:) @source = source @case_sensitive = case_sensitive end |
Instance Attribute Details
#case_sensitive ⇒ Object (readonly)
Returns the value of attribute case_sensitive.
5 6 7 |
# File 'lib/goodcheck/pattern.rb', line 5 def case_sensitive @case_sensitive end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
4 5 6 |
# File 'lib/goodcheck/pattern.rb', line 4 def source @source end |
Instance Method Details
#regexp ⇒ Object
12 13 14 |
# File 'lib/goodcheck/pattern.rb', line 12 def regexp @regexp ||= ::Regexp.compile(::Regexp.escape(source), !case_sensitive) end |