Class: LazyDoc::Commands::DefaultValueCommand
- Inherits:
-
Object
- Object
- LazyDoc::Commands::DefaultValueCommand
- Defined in:
- lib/lazy_doc/commands/default_value_command.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
Instance Method Summary collapse
- #execute(value) ⇒ Object
-
#initialize(default) ⇒ DefaultValueCommand
constructor
A new instance of DefaultValueCommand.
Constructor Details
#initialize(default) ⇒ DefaultValueCommand
Returns a new instance of DefaultValueCommand.
5 6 7 |
# File 'lib/lazy_doc/commands/default_value_command.rb', line 5 def initialize(default) @default = default end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
3 4 5 |
# File 'lib/lazy_doc/commands/default_value_command.rb', line 3 def default @default end |
Instance Method Details
#execute(value) ⇒ Object
9 10 11 |
# File 'lib/lazy_doc/commands/default_value_command.rb', line 9 def execute(value) use_default?(value) ? default : value end |