Module: Boson
- Extended by:
- Boson
- Included in:
- Boson
- Defined in:
- lib/boson.rb,
lib/boson/util.rb,
lib/boson/loader.rb,
lib/boson/runner.rb,
lib/boson/command.rb,
lib/boson/library.rb,
lib/boson/manager.rb,
lib/boson/options.rb,
lib/boson/version.rb,
lib/boson/inspector.rb,
lib/boson/scientist.rb,
lib/boson/bin_runner.rb,
lib/boson/bare_runner.rb,
lib/boson/option_parser.rb,
lib/boson/option_command.rb,
lib/boson/runner_library.rb,
lib/boson/method_inspector.rb
Overview
This module stores the libraries, commands and the main_object.
Useful documentation links:
-
Boson::Library - All about libraries
-
Boson::Loader - Explains library module callbacks
-
Boson::OptionParser - All about options
Defined Under Namespace
Modules: Commands, Loader, Options, Scientist, Universe, Util Classes: BareRunner, BinRunner, Command, DefaultCommandsRunner, Inspector, Library, LoaderError, Manager, MethodConflictError, MethodInspector, OptionCommand, OptionParser, Runner, RunnerLibrary
Constant Summary collapse
- CONFIG =
Default config
{libraries: {}, command_aliases: {}, option_underscore_search: true}
- VERSION =
'1.3.0'
Instance Attribute Summary collapse
-
#commands ⇒ Object
Array of loaded Boson::Command objects.
-
#config ⇒ Object
Global config used by most classes.
-
#debug ⇒ Object
Prints debugging info when set.
-
#in_shell ⇒ Object
Returns true if commands are being executed from a non-ruby shell i.e.
-
#libraries ⇒ Object
Array of loaded Boson::Library objects.
-
#main_object ⇒ Object
(also: #higgs)
The object which holds and executes all command functionality.
-
#verbose ⇒ Object
Returns true if in commandline with verbose flag or if set explicitly.
Instance Method Summary collapse
-
#can_invoke?(meth, priv = true) ⇒ Boolean
Boolean indicating if the main object can invoke the given method/command.
-
#full_invoke(cmd, args) ⇒ Object
Similar to invoke but accepts args as an array.
-
#invoke(*args, &block) ⇒ Object
Invoke an action on the main object.
-
#library(query, attribute = 'name') ⇒ Object
Finds first library that has a value of attribute.
Instance Attribute Details
#commands ⇒ Object
Array of loaded Boson::Command objects.
53 54 55 |
# File 'lib/boson.rb', line 53 def commands @commands end |
#config ⇒ Object
Global config used by most classes
58 59 60 |
# File 'lib/boson.rb', line 58 def config @config end |
#debug ⇒ Object
Prints debugging info when set
39 40 41 |
# File 'lib/boson.rb', line 39 def debug @debug end |
#in_shell ⇒ Object
Returns true if commands are being executed from a non-ruby shell i.e. bash Returns nil/false if in a ruby shell i.e. irb.
42 43 44 |
# File 'lib/boson.rb', line 42 def in_shell @in_shell end |
#libraries ⇒ Object
Array of loaded Boson::Library objects.
48 49 50 |
# File 'lib/boson.rb', line 48 def libraries @libraries end |
#main_object ⇒ Object Also known as: higgs
The object which holds and executes all command functionality
34 35 36 |
# File 'lib/boson.rb', line 34 def main_object @main_object end |
#verbose ⇒ Object
Returns true if in commandline with verbose flag or if set explicitly. Plugins should use this to display more info.
45 46 47 |
# File 'lib/boson.rb', line 45 def verbose @verbose end |
Instance Method Details
#can_invoke?(meth, priv = true) ⇒ Boolean
Boolean indicating if the main object can invoke the given method/command.
83 84 85 |
# File 'lib/boson.rb', line 83 def can_invoke?(meth, priv=true) Boson.main_object.respond_to? meth, priv end |
#full_invoke(cmd, args) ⇒ Object
Similar to invoke but accepts args as an array
78 79 80 |
# File 'lib/boson.rb', line 78 def full_invoke(cmd, args) main_object.send(cmd, *args) end |
#invoke(*args, &block) ⇒ Object
Invoke an action on the main object.
73 74 75 |
# File 'lib/boson.rb', line 73 def invoke(*args, &block) main_object.send(*args, &block) end |
#library(query, attribute = 'name') ⇒ Object
Finds first library that has a value of attribute
68 69 70 |
# File 'lib/boson.rb', line 68 def library(query, attribute='name') libraries.find {|e| e.send(attribute) == query } end |