Class: JsonCat::JsonPrettyPrinter
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#grep ⇒ Object
Returns the value of attribute grep.
-
#omit ⇒ Object
Returns the value of attribute omit.
-
#parse ⇒ Object
Returns the value of attribute parse.
-
#sort ⇒ Object
Returns the value of attribute sort.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(**opts) ⇒ JsonPrettyPrinter
constructor
A new instance of JsonPrettyPrinter.
- #print(line) ⇒ Object
Constructor Details
#initialize(**opts) ⇒ JsonPrettyPrinter
Returns a new instance of JsonPrettyPrinter.
19 20 21 22 |
# File 'lib/json_cat.rb', line 19 def initialize(**opts) self.count = 0 opts.each { |k, v| instance_variable_set("@#{k}", v) } end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
18 19 20 |
# File 'lib/json_cat.rb', line 18 def count @count end |
#grep ⇒ Object
Returns the value of attribute grep.
18 19 20 |
# File 'lib/json_cat.rb', line 18 def grep @grep end |
#omit ⇒ Object
Returns the value of attribute omit.
18 19 20 |
# File 'lib/json_cat.rb', line 18 def omit @omit end |
#parse ⇒ Object
Returns the value of attribute parse.
18 19 20 |
# File 'lib/json_cat.rb', line 18 def parse @parse end |
#sort ⇒ Object
Returns the value of attribute sort.
18 19 20 |
# File 'lib/json_cat.rb', line 18 def sort @sort end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
18 19 20 |
# File 'lib/json_cat.rb', line 18 def end |
Instance Method Details
#print(line) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/json_cat.rb', line 24 def print(line) x = json_parse(line) if x.is_a?(Hash) print_hash(x) else bow_print x end end |