Module: Quandl::Command::Task::Inputable

Extended by:
ActiveSupport::Concern
Included in:
Quandl::Command::Task
Defined in:
lib/quandl/command/task/inputable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#args_or_stdinObject



23
24
25
26
# File 'lib/quandl/command/task/inputable.rb', line 23

def args_or_stdin
  return args.join("\n") if args.first.present?
  $stdin
end

#each_line_in_background(args, &block) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/quandl/command/task/inputable.rb', line 15

def each_line_in_background(args, &block)
  args.each_line do |arg|
    background_job do
      block.call( arg )
    end
  end
end

#file_or_stdinObject



28
29
30
31
# File 'lib/quandl/command/task/inputable.rb', line 28

def file_or_stdin
  return File.open( args.first, 'r' ) if args.first.present?
  $stdin
end