Module: Hirb
- Defined in:
- lib/bbcloud/vendor/hirb-0.3.4/lib/hirb.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/menu.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/util.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/view.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/pager.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/views.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/string.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/console.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/helpers.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/version.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/formatter.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/dynamic_view.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/helpers/table.rb,
lib/bbcloud/vendor/hirb-0.3.4/lib/hirb/import_object.rb
Overview
Most of Hirb’s functionality is in Hirb::View. For a tutorial on configuring and creating views see Hirb::View. For a tutorial on dynamic views see Hirb::DynamicView.
Config Files
Hirb can have multiple config files defined by config_files(). These config files have the following top level keys:
- :output
-
This hash is used by the formatter object. See Hirb::Formatter.config for its format.
- :width
-
Width of the terminal/console. Defaults to Hirb::View::DEFAULT_WIDTH or possibly autodetected when Hirb is enabled.
- :height
-
Height of the terminal/console. Defaults to Hirb::View::DEFAULT_HEIGHT or possibly autodetected when Hirb is enabled.
- :formatter
-
Boolean which determines if the formatter is enabled. Defaults to true.
- :pager
-
Boolean which determines if the pager is enabled. Defaults to true.
- :pager_command
-
Command to be used for paging. Command can have options after it i.e. ‘less -r’. Defaults to common pagers i.e. less and more if detected.
- :ignore_errors
-
Boolean which ignores internal view errors and continues with original view (i.e. #inspect for irb). Defaults to false.
Defined Under Namespace
Modules: Console, DynamicView, Helpers, ObjectMethods, String, Util, View, Views Classes: Formatter, Menu, Pager
Constant Summary collapse
- VERSION =
'0.3.4'
Class Attribute Summary collapse
-
.config(reload = false) ⇒ Object
Returns the value of attribute config.
-
.config_files ⇒ Object
Array of config files which are merged sequentially to produce config.
Class Method Summary collapse
-
.add_dynamic_view(view, options, &block) ⇒ Object
Adds views.
-
.add_view(view, options, &block) ⇒ Object
Adds views.
-
.default_config_files ⇒ Object
:stopdoc:.
-
.disable ⇒ Object
Disables view functionality.
-
.enable(options = {}, &block) ⇒ Object
Enables view functionality.
- .read_config_file(file = config_file) ⇒ Object
Class Attribute Details
.config(reload = false) ⇒ Object
Returns the value of attribute config.
33 34 35 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/lib/hirb.rb', line 33 def config @config end |
.config_files ⇒ Object
Array of config files which are merged sequentially to produce config. Defaults to config/hirb.yml and ~/.hirb_yml
57 58 59 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/lib/hirb.rb', line 57 def config_files @config_files end |
Class Method Details
.add_dynamic_view(view, options, &block) ⇒ Object
Adds views. See Hirb::DynamicView.add for details.
51 52 53 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/lib/hirb.rb', line 51 def add_dynamic_view(view, , &block) DynamicView.add(view, , &block) end |
.add_view(view, options, &block) ⇒ Object
Adds views. See Hirb::View.add for details.
46 47 48 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/lib/hirb.rb', line 46 def add_view(view, , &block) View.add(view, , &block) end |
.default_config_files ⇒ Object
:stopdoc:
62 63 64 65 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/lib/hirb.rb', line 62 def default_config_files [File.join(Util.find_home, ".hirb.yml")] + (File.exists?('config/hirb.yml') ? ['config/hirb.yml'] : []) end |
.disable ⇒ Object
Disables view functionality. See Hirb::View.disable for details.
41 42 43 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/lib/hirb.rb', line 41 def disable View.disable end |
.enable(options = {}, &block) ⇒ Object
Enables view functionality. See Hirb::View.enable for details.
36 37 38 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/lib/hirb.rb', line 36 def enable(={}, &block) View.enable(, &block) end |
.read_config_file(file = config_file) ⇒ Object
67 68 69 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/lib/hirb.rb', line 67 def read_config_file(file=config_file) File.exists?(file) ? YAML::load_file(file) : {} end |