Class: StepMaster::StepVariable
- Defined in:
- lib/step_master/step_variable.rb
Constant Summary collapse
- ARG_TEXT_REGEX =
/\(.*?[^\\]\)/
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from StepItem
Instance Method Summary collapse
-
#initialize(text, options, name) ⇒ StepVariable
constructor
A new instance of StepVariable.
- #inspect ⇒ Object
- #to_s(options = {}) ⇒ Object
Methods inherited from StepItem
Constructor Details
#initialize(text, options, name) ⇒ StepVariable
Returns a new instance of StepVariable.
9 10 11 12 13 14 15 16 17 |
# File 'lib/step_master/step_variable.rb', line 9 def initialize(text, , name) super(text, ) @name = name.freeze raise "#{@text.inspect} is not a variable!" unless @text =~ ARG_TEXT_REGEX @easy = @name.nil? ? @text : $` + "<" + @name + ">" + $' @easy.freeze end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/step_master/step_variable.rb', line 7 def name @name end |
Instance Method Details
#inspect ⇒ Object
23 24 25 |
# File 'lib/step_master/step_variable.rb', line 23 def inspect "#{text.inspect}:#{name.inspect}" end |
#to_s(options = {}) ⇒ Object
19 20 21 |
# File 'lib/step_master/step_variable.rb', line 19 def to_s( = {}) [:easy] ? @easy : super() end |