Class: Bricolage::OptionalBoolParam

Inherits:
Param
  • Object
show all
Defined in:
lib/bricolage/parameters.rb

Instance Attribute Summary

Attributes inherited from Param

#arg_spec, #description, #name

Instance Method Summary collapse

Methods inherited from Param

#have_arg?, #inspect, #option_name, #optional?, #parse_option_value, #parse_value, #publish?, #required?

Constructor Details

#initialize(name, description, default: false, publish: false) ⇒ OptionalBoolParam

Returns a new instance of OptionalBoolParam.



370
371
372
373
# File 'lib/bricolage/parameters.rb', line 370

def initialize(name, description, default: false, publish: false)
  super name, nil, description, optional: true, publish: publish
  @default_value = default
end

Instance Method Details

#default_value(ctx, vars) ⇒ Object



375
376
377
# File 'lib/bricolage/parameters.rb', line 375

def default_value(ctx, vars)
  @default_value
end

#materialize(value, ctx, vars) ⇒ Object



379
380
381
# File 'lib/bricolage/parameters.rb', line 379

def materialize(value, ctx, vars)
  !!value
end

#variables(bool) ⇒ Object



383
384
385
# File 'lib/bricolage/parameters.rb', line 383

def variables(bool)
  wrap_variable_value(bool.to_s)
end