Class: AwesomePrint::Formatters::FileFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- AwesomePrint::Formatters::FileFormatter
- Defined in:
- lib/awesome_print/formatters/file_formatter.rb
Constant Summary
Constants inherited from BaseFormatter
BaseFormatter::DEFAULT_LIMIT_SIZE
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#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(file, inspector) ⇒ FileFormatter
constructor
A new instance of FileFormatter.
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(file, inspector) ⇒ FileFormatter
Returns a new instance of FileFormatter.
10 11 12 13 14 |
# File 'lib/awesome_print/formatters/file_formatter.rb', line 10 def initialize(file, inspector) @file = file @inspector = inspector @options = inspector. end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
8 9 10 |
# File 'lib/awesome_print/formatters/file_formatter.rb', line 8 def file @file end |
#inspector ⇒ Object (readonly)
Returns the value of attribute inspector.
8 9 10 |
# File 'lib/awesome_print/formatters/file_formatter.rb', line 8 def inspector @inspector end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/awesome_print/formatters/file_formatter.rb', line 8 def @options end |
Instance Method Details
#format ⇒ Object
16 17 18 19 |
# File 'lib/awesome_print/formatters/file_formatter.rb', line 16 def format ls = File.directory?(file) ? `ls -adlF #{file.path.shellescape}` : `ls -alF #{file.path.shellescape}` colorize(ls.empty? ? file.inspect : "#{file.inspect}\n#{ls.chop}", :file) end |