Class: Ltsview::Parse

Inherits:
Object
  • Object
show all
Defined in:
lib/ltsview/parse.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Parse

Returns a new instance of Parse.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/ltsview/parse.rb', line 4

def initialize(options)
  @options = {
    :mode =>       :yaml,
    :color =>      true,
    :file =>       nil,
    :keys =>       nil,
    :ignore_key => nil,
    :regex =>      nil,
    :reorder =>    false
  }
  option_parse options
end

Instance Method Details



17
18
19
20
21
22
23
24
# File 'lib/ltsview/parse.rb', line 17

def print
  file_or_stdin do |ltsv|
    next if ltsv.nil?
    line = formatter(reorder(filter(ltsv)))
    puts "#{tag}#{line}" unless line.nil?
    $stdout.flush
  end
end