Module: Tobacco

Defined in:
lib/tobacco/error.rb,
lib/tobacco.rb,
lib/tobacco/roller.rb,
lib/tobacco/smoker.rb,
lib/tobacco/burnout.rb,
lib/tobacco/exhaler.rb,
lib/tobacco/inhaler.rb,
lib/tobacco/version.rb,
lib/tobacco/callback.rb,
lib/tobacco/safety_net.rb,
lib/tobacco/test_helpers.rb,
lib/tobacco/content_reader.rb,
lib/tobacco/content_validator.rb

Overview

Backup is responsible for backing up the current file if it exists and restoring it in the event an error occurs while attempting to write new content.

Defined Under Namespace

Modules: Burnout, TestHelpers Classes: Callback, ContentReader, ContentValidator, Error, Exhaler, Inhaler, MissingContentError, Roller, SafetyNet, Smoker

Constant Summary collapse

VERSION =
"0.0.7"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.base_pathObject

Returns the value of attribute base_path.



19
20
21
# File 'lib/tobacco.rb', line 19

def base_path
  @base_path
end

.content_methodObject

Returns the value of attribute content_method.



19
20
21
# File 'lib/tobacco.rb', line 19

def content_method
  @content_method
end

.content_url_methodObject

Returns the value of attribute content_url_method.



19
20
21
# File 'lib/tobacco.rb', line 19

def content_url_method
  @content_url_method
end

.loggingObject

Returns the value of attribute logging.



19
20
21
# File 'lib/tobacco.rb', line 19

def logging
  @logging
end

.output_filepath_methodObject

Returns the value of attribute output_filepath_method.



19
20
21
# File 'lib/tobacco.rb', line 19

def output_filepath_method
  @output_filepath_method
end

.published_hostObject

Returns the value of attribute published_host.



19
20
21
# File 'lib/tobacco.rb', line 19

def published_host
  @published_host
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Tobacco)

    the object that the method was called on



27
28
29
# File 'lib/tobacco.rb', line 27

def self.configure
  yield self
end

.log(msg) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/tobacco.rb', line 31

def self.log(msg)
  return unless logging

  log_msg =  "\n*******************************************\n"
  log_msg += "Tobacco::Log: #{msg}\n"
  log_msg += "*******************************************\n"

  if defined? Rails
    Rails.logger.info(log_msg)
  else
    puts log_msg
  end
end