Class: WTF::Dumper
- Inherits:
-
Object
- Object
- WTF::Dumper
- Defined in:
- lib/wtf/dumper.rb
Defined Under Namespace
Classes: Output
Constant Summary collapse
- PREFIX_OPTIONS =
[:time, :nl, :np].freeze
- FORMAT_OPTIONS =
[:pp, :yaml, :json, :text, :line, :csv].freeze
- MODIFY_OPTIONS =
[:bare, :name].freeze
- OUTPUT_OPTIONS =
[:puts, :error, :file].freeze
- OPTIONS =
(PREFIX_OPTIONS + FORMAT_OPTIONS + MODIFY_OPTIONS + OUTPUT_OPTIONS).freeze
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(*args) ⇒ Dumper
constructor
A new instance of Dumper.
Constructor Details
#initialize(*args) ⇒ Dumper
Returns a new instance of Dumper.
12 13 14 15 16 17 18 |
# File 'lib/wtf/dumper.rb', line 12 def initialize(*args) @args = args @options = {} while is_option?(args.last) @options[args.pop] = true end end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
10 11 12 |
# File 'lib/wtf/dumper.rb', line 10 def args @args end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/wtf/dumper.rb', line 10 def @options end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 |
# File 'lib/wtf/dumper.rb', line 20 def call where, names = parse_source(caller[1]) data = prefix(where) << format(names) output(data) end |