Class: NamedArg
- Inherits:
-
Object
- Object
- NamedArg
- Defined in:
- lib/generators/cucumber/feature/named_arg.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(s) ⇒ NamedArg
constructor
A new instance of NamedArg.
- #value(n) ⇒ Object
Constructor Details
#initialize(s) ⇒ NamedArg
Returns a new instance of NamedArg.
5 6 7 |
# File 'lib/generators/cucumber/feature/named_arg.rb', line 5 def initialize(s) @name, @type = *s.split(':') end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/generators/cucumber/feature/named_arg.rb', line 2 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/generators/cucumber/feature/named_arg.rb', line 3 def type @type end |
Instance Method Details
#value(n) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/generators/cucumber/feature/named_arg.rb', line 9 def value(n) if @type == 'boolean' (n % 2) == 0 else "#{@name} #{n}" end end |