class Reportier::Reporter

Attributes

reporters[RW]

Public Class Methods

get() click to toggle source
# File lib/reportier/reporter.rb, line 5
def self.get
  @current ||= new(Defaults.global.reporters)
end
new(reporters) click to toggle source
# File lib/reportier/reporter.rb, line 9
def initialize(reporters)
  @reporters = reporters
end

Public Instance Methods

call(tracker, &blk) click to toggle source
# File lib/reportier/reporter.rb, line 13
def call(tracker, &blk)
  @reporters.each do |reporter, v|
    eval "to_#{Namer.new.name(reporter)} \"#{blk.call}\""
  end
end

Private Instance Methods

create_dir(dir) click to toggle source
# File lib/reportier/reporter.rb, line 45
def create_dir(dir)
  require 'fileutils'
  FileUtils.mkdir_p dir
end
to_console(message) click to toggle source
# File lib/reportier/reporter.rb, line 21
def to_console(message)
  puts message
end
to_logger(message) click to toggle source
# File lib/reportier/reporter.rb, line 32
def to_logger(message)
  create_dir('log') unless Dir.exists? 'log'
  ::Logger.new('log/reportier.log').info("\n" + message)
rescue NameError
  Logger.new('log/reportier.log').info("\n" + message)
end
to_slack(message) click to toggle source
# File lib/reportier/reporter.rb, line 25
def to_slack(message)
  type = message.split.first + '_tracker'
  SlackReporter.new(type).call do
    message
  end
end
to_twilio() click to toggle source
# File lib/reportier/reporter.rb, line 39
def to_twilio

end