Class: InstagramCrawler::MultiIO

Inherits:
Object
  • Object
show all
Defined in:
lib/instagram_crawler/multi_io.rb

Instance Method Summary collapse

Constructor Details

#initialize(*targets) ⇒ MultiIO

Returns a new instance of MultiIO.



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/instagram_crawler/multi_io.rb', line 3

def initialize(*targets)
  @targets = targets
  @shell_colors = {
    light_red:     '\\e\\[0;91;49m',
    light_green:   '\\e\\[0;92;49m',
    light_yellow:  '\\e\\[0;93;49m',
    light_blue:    '\\e\\[0;94;49m',
    light_magenta: '\\e\\[0;95;49m',
    light_cyan:    '\\e\\[0;96;49m',
    out_put:       '\\e\\[0m'
  }
end

Instance Method Details

#closeObject



23
24
25
# File 'lib/instagram_crawler/multi_io.rb', line 23

def close
  @targets.each(&:close)
end

#write(args) ⇒ Object



16
17
18
19
20
21
# File 'lib/instagram_crawler/multi_io.rb', line 16

def write(args)
  @targets.each do |target|
    pretty_file_text(args) if target.is_a? File
    target.write(args)
  end
end