Class: Shhh::App::Output::File

Inherits:
Object
  • Object
show all
Defined in:
lib/shhh/app/output/file.rb

Direct Known Subclasses

Stdout

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cli) ⇒ File

Returns a new instance of File


7
8
9
# File 'lib/shhh/app/output/file.rb', line 7

def initialize(cli)
  self.cli = cli
end

Instance Attribute Details

#cliObject

Returns the value of attribute cli


5
6
7
# File 'lib/shhh/app/output/file.rb', line 5

def cli
  @cli
end

Instance Method Details

#optsObject


11
12
13
# File 'lib/shhh/app/output/file.rb', line 11

def opts
  cli.opts
end

#output_procObject


15
16
17
18
19
# File 'lib/shhh/app/output/file.rb', line 15

def output_proc
  ->(data) {
    ::File.open(opts[:output], 'w') { |f| f.write(data) }
  }
end