Class: Carpenter::Model::Param

Inherits:
Object
  • Object
show all
Defined in:
lib/struct_declaration.rb,
lib/carpenter/model/param.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, **options) ⇒ Param

Returns a new instance of Param.



5
6
7
8
9
# File 'lib/carpenter/model/param.rb', line 5

def initialize(name, value, **options)
  @name = name
  @value = value
  @options = options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/carpenter/model/param.rb', line 2

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



2
3
4
# File 'lib/carpenter/model/param.rb', line 2

def options
  @options
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/carpenter/model/param.rb', line 3

def value
  @value
end

Instance Method Details

#dupObject



11
12
13
# File 'lib/carpenter/model/param.rb', line 11

def dup
  self.class.new(name, value, **options)
end

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/carpenter/model/param.rb', line 15

def valid?
  return false if @options[:force] && @value.nil?

  true
end