Module: Bio::Command::Wrapper::ClassMethods
- Defined in:
- lib/wrapper.rb
Constant Summary collapse
- OUTPUT =
TODO: do I need to set a default program name using class name or not ?
or do we need to specify somewhere a defaitl path and looking for a real binary ?
[:file, :stdout, :stdin]
Instance Attribute Summary collapse
-
#aliases ⇒ Object
output = :stdout=>.
-
#options ⇒ Object
output = :stdout=>.
-
#output ⇒ Object
output = :stdout=>.
-
#program ⇒ Object
output = :stdout=>.
-
#sub_program ⇒ Object
output = :stdout=>.
Instance Method Summary collapse
-
#add_option(name, opt = {}) ⇒ Object
external_parameter can be an array a string or an hash def validate_parameters(external_parameters).
-
#delete_option(name) ⇒ Object
Remove an option from the class.
-
#inherited(subclass) ⇒ Object
Propagate class variable in the superclass to the inherited class, so options defined in a previous wrap can be recicled.
-
#set_output(output_type = :file) ⇒ Object
TODO I don’t like this way, Is it possible to configure the variable as global and default ?.
- #use_aliases ⇒ Object
Instance Attribute Details
#aliases ⇒ Object
output = :stdout=>
242 243 244 |
# File 'lib/wrapper.rb', line 242 def aliases @aliases end |
#options ⇒ Object
output = :stdout=>
242 243 244 |
# File 'lib/wrapper.rb', line 242 def @options end |
#output ⇒ Object
output = :stdout=>
242 243 244 |
# File 'lib/wrapper.rb', line 242 def output @output end |
#program ⇒ Object
output = :stdout=>
242 243 244 |
# File 'lib/wrapper.rb', line 242 def program @program end |
#sub_program ⇒ Object
output = :stdout=>
242 243 244 |
# File 'lib/wrapper.rb', line 242 def sub_program @sub_program end |
Instance Method Details
#add_option(name, opt = {}) ⇒ Object
external_parameter can be an array a string or an hash def validate_parameters(external_parameters)
259 260 261 |
# File 'lib/wrapper.rb', line 259 def add_option(name, opt={}) @options = (@options || {}).merge(name.to_s=>opt) end |
#delete_option(name) ⇒ Object
Remove an option from the class
264 265 266 |
# File 'lib/wrapper.rb', line 264 def delete_option(name) @options.delete(name) end |
#inherited(subclass) ⇒ Object
Propagate class variable in the superclass to the inherited class, so options defined in a previous wrap can be recicled.
230 231 232 233 234 |
# File 'lib/wrapper.rb', line 230 def inherited(subclass) self.instance_variables.each do |var| subclass.instance_variable_set(var, self.instance_variable_get(var)) end end |
#set_output(output_type = :file) ⇒ Object
TODO I don’t like this way, Is it possible to configure the variable as global and default ?
245 246 247 248 249 250 251 |
# File 'lib/wrapper.rb', line 245 def set_output(output_type=:file) if OUTPUT.include? output_type @output = output_type else raise "Output type #{output_type} is not suported. Valid types are #{OUTPUT}" end end |
#use_aliases ⇒ Object
253 254 255 |
# File 'lib/wrapper.rb', line 253 def use_aliases @aliases = true end |