Class: Bricolage::BoolParam

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, publish: false) ⇒ BoolParam

Returns a new instance of BoolParam.



352
353
354
# File 'lib/bricolage/parameters.rb', line 352

def initialize(name, description, publish: false)
  super name, nil, description, publish: publish
end

Instance Method Details

#default_value(ctx, vars) ⇒ Object



356
357
358
# File 'lib/bricolage/parameters.rb', line 356

def default_value(ctx, vars)
  false
end

#materialize(value, ctx, vars) ⇒ Object



360
361
362
# File 'lib/bricolage/parameters.rb', line 360

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

#variables(bool) ⇒ Object



364
365
366
# File 'lib/bricolage/parameters.rb', line 364

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