Class: Bricolage::Param
- Inherits:
-
Object
- Object
- Bricolage::Param
- Defined in:
- lib/bricolage/parameters.rb
Overview
class Parameters
Direct Known Subclasses
BoolParam, DataSourceParam, DateParam, DestFileParam, DestTableParam, EnumParam, KeyValuePairsParam, OptionalBoolParam, SQLFileParam, SrcFileParam, SrcTableParam, StringListParam, StringParam
Instance Attribute Summary collapse
-
#arg_spec ⇒ Object
readonly
Returns the value of attribute arg_spec.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #have_arg? ⇒ Boolean
-
#initialize(name, arg_spec, description, optional: false, publish: false) ⇒ Param
constructor
A new instance of Param.
- #inspect ⇒ Object
- #option_name ⇒ Object
- #optional? ⇒ Boolean
-
#parse_option_value(arg, acc) ⇒ Object
Value Handling.
- #parse_value(value) ⇒ Object
-
#publish? ⇒ Boolean
“published” parameter defines SQL variable.
- #required? ⇒ Boolean
Constructor Details
#initialize(name, arg_spec, description, optional: false, publish: false) ⇒ Param
Returns a new instance of Param.
261 262 263 264 265 266 267 |
# File 'lib/bricolage/parameters.rb', line 261 def initialize(name, arg_spec, description, optional: false, publish: false) @name = name @arg_spec = arg_spec @description = description @optional = optional @publish = publish end |
Instance Attribute Details
#arg_spec ⇒ Object (readonly)
Returns the value of attribute arg_spec.
276 277 278 |
# File 'lib/bricolage/parameters.rb', line 276 def arg_spec @arg_spec end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
270 271 272 |
# File 'lib/bricolage/parameters.rb', line 270 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
269 270 271 |
# File 'lib/bricolage/parameters.rb', line 269 def name @name end |
Instance Method Details
#have_arg? ⇒ Boolean
278 279 280 |
# File 'lib/bricolage/parameters.rb', line 278 def have_arg? !!@arg_spec end |
#inspect ⇒ Object
295 296 297 298 299 300 301 |
# File 'lib/bricolage/parameters.rb', line 295 def inspect attrs = [ (@optional ? 'optional' : 'required'), (@publish ? 'publish' : nil) ].compact.join(',') "\#<#{self.class} #{name} #{attrs}>" end |
#option_name ⇒ Object
272 273 274 |
# File 'lib/bricolage/parameters.rb', line 272 def option_name name end |
#optional? ⇒ Boolean
282 283 284 |
# File 'lib/bricolage/parameters.rb', line 282 def optional? @optional end |
#parse_option_value(arg, acc) ⇒ Object
Value Handling
307 308 309 310 |
# File 'lib/bricolage/parameters.rb', line 307 def parse_option_value(arg, acc) return nil if arg.nil? arg end |
#parse_value(value) ⇒ Object
312 313 314 |
# File 'lib/bricolage/parameters.rb', line 312 def parse_value(value) value end |
#publish? ⇒ Boolean
“published” parameter defines SQL variable.
291 292 293 |
# File 'lib/bricolage/parameters.rb', line 291 def publish? @publish end |
#required? ⇒ Boolean
286 287 288 |
# File 'lib/bricolage/parameters.rb', line 286 def required? not optional? end |