Class: Cased::Sensitive::String
- Inherits:
-
String
- Object
- String
- Cased::Sensitive::String
- Defined in:
- lib/cased/sensitive/string.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(string, label: nil) ⇒ String
constructor
A new instance of String.
- #matches(regex) ⇒ Object
- #range(key:) ⇒ Object
Constructor Details
#initialize(string, label: nil) ⇒ String
Returns a new instance of String.
10 11 12 13 |
# File 'lib/cased/sensitive/string.rb', line 10 def initialize(string, label: nil) super(string) @label = label end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
8 9 10 |
# File 'lib/cased/sensitive/string.rb', line 8 def label @label end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
8 9 10 |
# File 'lib/cased/sensitive/string.rb', line 8 def string @string end |
Instance Method Details
#==(other) ⇒ Object
36 37 38 39 |
# File 'lib/cased/sensitive/string.rb', line 36 def ==(other) super(other) && @label == other.label end |
#matches(regex) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cased/sensitive/string.rb', line 24 def matches(regex) offset = 0 matches = [] while (result = match(regex, offset)) matches.push(result) offset = result.end(0) end matches end |