Class: StepMaster::StepItem
- Inherits:
-
Object
- Object
- StepMaster::StepItem
- Defined in:
- lib/step_master/step_item.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #eql?(o) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(text, opts = "") ⇒ StepItem
constructor
A new instance of StepItem.
- #inspect ⇒ Object
- #to_regexp ⇒ Object
- #to_s(options = {}) ⇒ Object
Constructor Details
#initialize(text, opts = "") ⇒ StepItem
Returns a new instance of StepItem.
5 6 7 8 9 |
# File 'lib/step_master/step_item.rb', line 5 def initialize(text, opts = "") @text = text.freeze @options = 0 @options |= (opts.match(/i/) ? Regexp::IGNORECASE : 0) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/step_master/step_item.rb', line 3 def @options end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
3 4 5 |
# File 'lib/step_master/step_item.rb', line 3 def text @text end |
Instance Method Details
#eql?(o) ⇒ Boolean
23 24 25 |
# File 'lib/step_master/step_item.rb', line 23 def eql?(o) o.is_a?(StepItem) && self.text.eql?(o.text) end |
#hash ⇒ Object
27 28 29 |
# File 'lib/step_master/step_item.rb', line 27 def hash text.hash end |
#inspect ⇒ Object
19 20 21 |
# File 'lib/step_master/step_item.rb', line 19 def inspect text.inspect end |
#to_regexp ⇒ Object
11 12 13 |
# File 'lib/step_master/step_item.rb', line 11 def to_regexp @regex = Regexp.new("^" << text, ).freeze end |
#to_s(options = {}) ⇒ Object
15 16 17 |
# File 'lib/step_master/step_item.rb', line 15 def to_s( = {}) text end |