Class: StepMaster::StepItem

Inherits:
Object
  • Object
show all
Defined in:
lib/step_master/step_item.rb

Direct Known Subclasses

StepVariable

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/step_master/step_item.rb', line 3

def options
  @options
end

#textObject (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

Returns:

  • (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

#hashObject



27
28
29
# File 'lib/step_master/step_item.rb', line 27

def hash
	text.hash
end

#inspectObject



19
20
21
# File 'lib/step_master/step_item.rb', line 19

def inspect
	text.inspect
end

#to_regexpObject



11
12
13
# File 'lib/step_master/step_item.rb', line 11

def to_regexp
	@regex = Regexp.new("^" << text, options).freeze
end

#to_s(options = {}) ⇒ Object



15
16
17
# File 'lib/step_master/step_item.rb', line 15

def to_s(options = {})
	text
end