Class: Redactor::Extract
- Inherits:
-
Object
- Object
- Redactor::Extract
- Defined in:
- lib/redactor/extract.rb
Instance Attribute Summary collapse
-
#finish ⇒ Object
readonly
Returns the value of attribute finish.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #collides?(extract) ⇒ Boolean
-
#initialize(rule:, value:, start:, finish:) ⇒ Extract
constructor
A new instance of Extract.
- #reason ⇒ Object
Constructor Details
#initialize(rule:, value:, start:, finish:) ⇒ Extract
Returns a new instance of Extract.
5 6 7 8 9 10 |
# File 'lib/redactor/extract.rb', line 5 def initialize(rule:, value:, start:, finish:) @rule = rule @value = value @start = start @finish = finish end |
Instance Attribute Details
#finish ⇒ Object (readonly)
Returns the value of attribute finish.
3 4 5 |
# File 'lib/redactor/extract.rb', line 3 def finish @finish end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
3 4 5 |
# File 'lib/redactor/extract.rb', line 3 def rule @rule end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
3 4 5 |
# File 'lib/redactor/extract.rb', line 3 def start @start end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/redactor/extract.rb', line 3 def value @value end |
Instance Method Details
#collides?(extract) ⇒ Boolean
16 17 18 19 20 |
# File 'lib/redactor/extract.rb', line 16 def collides?(extract) [:start, :finish].any? do |m| extract.send(m).between?(start, finish) end end |
#reason ⇒ Object
12 13 14 |
# File 'lib/redactor/extract.rb', line 12 def reason rule.reason end |