Class: LazyDoc::Commands::DefaultValueCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/lazy_doc/commands/default_value_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

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