Module: Hirb
- Defined in:
- lib/hirber.rb,
lib/hirb/menu.rb,
lib/hirb/util.rb,
lib/hirb/view.rb,
lib/hirb/pager.rb,
lib/hirb/views.rb,
lib/hirb/string.rb,
lib/hirb/console.rb,
lib/hirb/helpers.rb,
lib/hirb/version.rb,
lib/hirb/formatter.rb,
lib/hirb/dynamic_view.rb,
lib/hirb/helpers/table.rb,
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.8.7"
Class Attribute Summary collapse
-
.config(reload = false) ⇒ Object
Returns the value of attribute config.
-
.config_files ⇒ Object
Returns the value of attribute config_files.
Class Method Summary collapse
-
.add_dynamic_view(view, options, &block) ⇒ Object
Adds views.
-
.add_view(view, options) ⇒ Object
Adds views.
-
.default_config_files ⇒ Object
:stopdoc:.
-
.disable ⇒ Object
Disables view functionality.
-
.enable(options = {}) ⇒ Object
Enables view functionality.
- .read_config_file(file = config_file) ⇒ Object
Class Attribute Details
.config(reload = false) ⇒ Object
Returns the value of attribute config.
35 36 37 |
# File 'lib/hirber.rb', line 35 def config @config end |
.config_files ⇒ Object
Returns the value of attribute config_files.
35 36 37 |
# File 'lib/hirber.rb', line 35 def config_files @config_files end |
Class Method Details
.add_dynamic_view(view, options, &block) ⇒ Object
Adds views. See Hirb::DynamicView.add for details.
53 54 55 |
# File 'lib/hirber.rb', line 53 def add_dynamic_view(view, , &block) DynamicView.add(view, , &block) end |
.add_view(view, options) ⇒ Object
Adds views. See Hirb::View.add for details.
48 49 50 |
# File 'lib/hirber.rb', line 48 def add_view(view, ) View.add(view, ) end |
.default_config_files ⇒ Object
:stopdoc:
65 66 67 68 |
# File 'lib/hirber.rb', line 65 def default_config_files [File.join(Util.find_home, ".hirb.yml")] + (File.exist?('config/hirb.yml') ? ['config/hirb.yml'] : []) end |
.disable ⇒ Object
Disables view functionality. See Hirb::View.disable for details.
43 44 45 |
# File 'lib/hirber.rb', line 43 def disable View.disable end |
.enable(options = {}) ⇒ Object
Enables view functionality. See Hirb::View.enable for details.
38 39 40 |
# File 'lib/hirber.rb', line 38 def enable(={}) View.enable() end |
.read_config_file(file = config_file) ⇒ Object
70 71 72 |
# File 'lib/hirber.rb', line 70 def read_config_file(file=config_file) File.exist?(file) ? YAML.load_file(file) : {} end |