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.4"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.config(reload = false) ⇒ Object

Returns the value of attribute config.



34
35
36
# File 'lib/hirber.rb', line 34

def config
  @config
end

.config_filesObject

Returns the value of attribute config_files.



34
35
36
# File 'lib/hirber.rb', line 34

def config_files
  @config_files
end

Class Method Details

.add_dynamic_view(view, options, &block) ⇒ Object

Adds views. See Hirb::DynamicView.add for details.



52
53
54
# File 'lib/hirber.rb', line 52

def add_dynamic_view(view, options, &block)
  DynamicView.add(view, options, &block)
end

.add_view(view, options) ⇒ Object

Adds views. See Hirb::View.add for details.



47
48
49
# File 'lib/hirber.rb', line 47

def add_view(view, options)
  View.add(view, options)
end

.default_config_filesObject

:stopdoc:



64
65
66
67
# File 'lib/hirber.rb', line 64

def default_config_files
  [File.join(Util.find_home, ".hirb.yml")] +
    (File.exist?('config/hirb.yml') ? ['config/hirb.yml'] : [])
end

.disableObject

Disables view functionality. See Hirb::View.disable for details.



42
43
44
# File 'lib/hirber.rb', line 42

def disable
  View.disable
end

.enable(options = {}) ⇒ Object

Enables view functionality. See Hirb::View.enable for details.



37
38
39
# File 'lib/hirber.rb', line 37

def enable(options={})
  View.enable(options)
end

.read_config_file(file = config_file) ⇒ Object



69
70
71
# File 'lib/hirber.rb', line 69

def read_config_file(file=config_file)
  File.exist?(file) ? YAML.load_file(file) : {}
end