Class: Bricolage::SQLFileParam
- Inherits:
-
Param
- Object
- Param
- Bricolage::SQLFileParam
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 = 'sql-file', arg_spec = 'PATH', description = 'SQL file.', optional: false, publish: false) ⇒ SQLFileParam
471
472
473
|
# File 'lib/bricolage/parameters.rb', line 471
def initialize(name = 'sql-file', arg_spec = 'PATH', description = 'SQL file.', optional: false, publish: false)
super name, arg_spec, description, optional: optional, publish: publish
end
|
Instance Method Details
#default_value(ctx, vars) ⇒ Object
475
476
477
|
# File 'lib/bricolage/parameters.rb', line 475
def default_value(ctx, vars)
nil
end
|
#materialize(name_or_stmt, ctx, vars) ⇒ Object
479
480
481
482
483
484
485
486
487
488
489
|
# File 'lib/bricolage/parameters.rb', line 479
def materialize(name_or_stmt, ctx, vars)
case name_or_stmt
when String
name = name_or_stmt
SQLStatement.new(ctx.parameter_file(expand(name.to_s, vars), 'sql'))
when SQLStatement
name_or_stmt
else
raise ParameterError, "unknown type for parameter #{name}: #{name_or_stmt.class}"
end
end
|
#variables(stmt) ⇒ Object
491
492
493
|
# File 'lib/bricolage/parameters.rb', line 491
def variables(stmt)
wrap_variable_value(stmt.location)
end
|