Class: AmazingPrint::Formatters::DirFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- AmazingPrint::Formatters::DirFormatter
- Defined in:
- lib/amazing_print/formatters/dir_formatter.rb
Constant Summary
Constants inherited from BaseFormatter
BaseFormatter::DEFAULT_LIMIT_SIZE, BaseFormatter::INDENT_CACHE
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#inspector ⇒ Object
readonly
Returns the value of attribute inspector.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(dir, inspector) ⇒ DirFormatter
constructor
A new instance of DirFormatter.
Methods inherited from BaseFormatter
#align, #get_limit_size, #indent, #indentation, #indented, #limited, #method_tuple, #outdent, #should_be_limited?
Methods included from Colorize
Constructor Details
#initialize(dir, inspector) ⇒ DirFormatter
Returns a new instance of DirFormatter.
12 13 14 15 16 17 |
# File 'lib/amazing_print/formatters/dir_formatter.rb', line 12 def initialize(dir, inspector) super() @dir = dir @inspector = inspector @options = inspector. end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
10 11 12 |
# File 'lib/amazing_print/formatters/dir_formatter.rb', line 10 def dir @dir end |
#inspector ⇒ Object (readonly)
Returns the value of attribute inspector.
10 11 12 |
# File 'lib/amazing_print/formatters/dir_formatter.rb', line 10 def inspector @inspector end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/amazing_print/formatters/dir_formatter.rb', line 10 def @options end |
Instance Method Details
#format ⇒ Object
19 20 21 22 |
# File 'lib/amazing_print/formatters/dir_formatter.rb', line 19 def format ls = `ls -alF #{dir.path.shellescape}` colorize(ls.empty? ? dir.inspect : "#{dir.inspect}\n#{ls.chop}", :dir) end |