Class: Coral::Plugin::Command
- Defined in:
- lib/coral_core/plugin/command.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Core
Instance Method Summary collapse
-
#args(default = []) ⇒ Object
—.
-
#args=(args) ⇒ Object
—.
-
#build(components = {}, overrides = nil, override_key = false) ⇒ Object
—————————————————————————– Command operations.
-
#command(default = '') ⇒ Object
—————————————————————————– Property accessor / modifiers.
-
#command=(command) ⇒ Object
—.
-
#data(default = {}) ⇒ Object
—.
-
#data=(data) ⇒ Object
—.
-
#exec(options = {}, overrides = nil) ⇒ Object
—.
-
#exec!(options = {}, overrides = nil) ⇒ Object
—.
-
#flags(default = []) ⇒ Object
—.
-
#flags=(flags) ⇒ Object
—.
-
#subcommand=(subcommand) ⇒ Object
—.
-
#to_s ⇒ Object
—————————————————————————– Command plugin interface.
Methods inherited from Base
build_info, ensure_plugin_collection, #initialize, #initialized?, #meta, #method_missing, #name, #name=, #normalize, #plugin_directory, #plugin_file, #plugin_instance_name, #plugin_parent, #plugin_parent=, #plugin_provider, #plugin_type, #set_meta, translate
Methods inherited from Core
#initialize, #inspect, #logger, logger, logger=, ui
Methods inherited from Config
#[], #[]=, array, #array, #clear, #defaults, #delete, ensure, #export, #filter, filter, #get, #get_array, #get_hash, #hash, hash, #import, init, #init, init_flat, #initialize, #set, #string, string, string_map, #string_map, #symbol, symbol, symbol_map, #symbol_map, test, #test
Methods included from Mixin::ConfigOptions
#clear_options, #contexts, #get_options, #set_options
Methods included from Mixin::ConfigCollection
#all_properties, #clear_properties, #delete_property, #get_property, #save_properties, #set_property
Methods included from Mixin::Lookup
#hiera, #hiera_config, #initialized?, #lookup, #lookup_array, #lookup_hash, #normalize
Methods included from Mixin::ConfigOps
Constructor Details
This class inherits a constructor from Coral::Plugin::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Coral::Plugin::Base
Instance Method Details
#args(default = []) ⇒ Object
28 29 30 |
# File 'lib/coral_core/plugin/command.rb', line 28 def args(default = []) return array(get(:args, default)) end |
#args=(args) ⇒ Object
34 35 36 |
# File 'lib/coral_core/plugin/command.rb', line 34 def args=args set(:args, array(args)) end |
#build(components = {}, overrides = nil, override_key = false) ⇒ Object
Command operations
77 78 79 |
# File 'lib/coral_core/plugin/command.rb', line 77 def build(components = {}, overrides = nil, override_key = false) return '' # Implement in sub classes end |
#command(default = '') ⇒ Object
Property accessor / modifiers
16 17 18 |
# File 'lib/coral_core/plugin/command.rb', line 16 def command(default = '') return string(get(:command, default)) end |
#command=(command) ⇒ Object
22 23 24 |
# File 'lib/coral_core/plugin/command.rb', line 22 def command=command set(:command, string(command)) end |
#data(default = {}) ⇒ Object
52 53 54 |
# File 'lib/coral_core/plugin/command.rb', line 52 def data(default = {}) return hash(get(:data, default)) end |
#data=(data) ⇒ Object
58 59 60 |
# File 'lib/coral_core/plugin/command.rb', line 58 def data=data set(:data, hash(data)) end |
#exec(options = {}, overrides = nil) ⇒ Object
90 91 92 |
# File 'lib/coral_core/plugin/command.rb', line 90 def exec( = {}, overrides = nil) return exec!(, overrides) end |
#exec!(options = {}, overrides = nil) ⇒ Object
83 84 85 86 |
# File 'lib/coral_core/plugin/command.rb', line 83 def exec!( = {}, overrides = nil) # Implement in sub classes (don't forget the yield!) return true end |
#flags(default = []) ⇒ Object
40 41 42 |
# File 'lib/coral_core/plugin/command.rb', line 40 def flags(default = []) return array(get(:flags, default)) end |
#flags=(flags) ⇒ Object
46 47 48 |
# File 'lib/coral_core/plugin/command.rb', line 46 def flags=flags set(:flags, array(flags)) end |
#subcommand=(subcommand) ⇒ Object
64 65 66 67 68 |
# File 'lib/coral_core/plugin/command.rb', line 64 def subcommand=subcommand unless Util::Data.empty?(subcommand) set(:subcommand, new(hash(subcommand))) end end |
#to_s ⇒ Object
Command plugin interface
9 10 11 |
# File 'lib/coral_core/plugin/command.rb', line 9 def to_s return build(export) end |