Class: Bricolage::Parameters

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

Defined Under Namespace

Classes: CommandLineOptionHandler, Declarations, DefaultValuesHandler, DirectValueHandler, IntermediateValues

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(decls, values, vars, ctx) ⇒ Parameters

class Parameters Materialized, fixed job parameter values.



219
220
221
222
223
224
# File 'lib/bricolage/parameters.rb', line 219

def initialize(decls, values, vars, ctx)
  @decls = decls     # Declarations
  @values = values   # {name => a}
  @variables = vars  # ResolvedVariables
  @context = ctx     # Context
end

Instance Attribute Details

#variablesObject (readonly)

Returns the value of attribute variables.



241
242
243
# File 'lib/bricolage/parameters.rb', line 241

def variables
  @variables
end

Instance Method Details

#[](key) ⇒ Object Also known as: get

Raises:



230
231
232
233
# File 'lib/bricolage/parameters.rb', line 230

def [](key)
  raise ParameterError, "no such parameter: #{key}" unless @values.key?(key)
  @values[key]
end

#file_dsObject

FIXME: remove



249
250
251
# File 'lib/bricolage/parameters.rb', line 249

def file_ds
  @context.get_data_source('file', 'file')
end

#generic_dsObject

FIXME: remove



244
245
246
# File 'lib/bricolage/parameters.rb', line 244

def generic_ds
  @context.get_data_source('generic', 'generic')
end

#inspectObject



226
227
228
# File 'lib/bricolage/parameters.rb', line 226

def inspect
  "\#<#{self.class} #{@values.inspect}>"
end

#keysObject



237
238
239
# File 'lib/bricolage/parameters.rb', line 237

def keys
  @values.keys
end

#ruby_dsObject

FIXME: remove



254
255
256
# File 'lib/bricolage/parameters.rb', line 254

def ruby_ds
  @context.get_data_source('ruby', 'ruby')
end