Module: Stilts
- Defined in:
- lib/stilts/rack.rb,
lib/stilts.rb,
lib/stilts/batch.rb,
lib/stilts/image.rb,
lib/stilts/sender.rb,
lib/stilts/railtie.rb,
lib/stilts/version.rb,
lib/stilts/receiver.rb,
lib/stilts/rails/hooks.rb,
lib/stilts/configuration.rb,
lib/stilts/rails/helpers.rb
Overview
Simply grab the headers out of the request for use later
Defined Under Namespace
Modules: Helpers, Hooks Classes: Batch, Configuration, Image, Rack, Railtie, Receiver, Sender
Constant Summary collapse
- LOG_PREFIX =
"[Stilts] "
- VERSION =
"0.0.4"
Class Attribute Summary collapse
-
.configuration ⇒ Object
A configuration object.
-
.receiver ⇒ Object
A receiver of requests.
-
.sender ⇒ Object
The sender object is responsible for delivering formatted data to the server.
Class Method Summary collapse
- .configure(silent = false) {|configuration| ... } ⇒ Object
-
.environment_info ⇒ Object
Returns the Ruby version, Rails version, and current Rails environment.
- .logger ⇒ Object
-
.report_environment_info ⇒ Object
Prints out the environment info to the log for debugging help.
-
.report_response_body(response) ⇒ Object
Prints out the response body from Stilts for debugging help.
-
.write_verbose_log(message) ⇒ Object
Writes out the given message to the #logger.
Class Attribute Details
.configuration ⇒ Object
A configuration object. Must act like a hash and return sensible values for all configuration options. See Stilts::Configuration.
29 30 31 |
# File 'lib/stilts.rb', line 29 def configuration @configuration end |
.receiver ⇒ Object
A receiver of requests
32 33 34 |
# File 'lib/stilts.rb', line 32 def receiver @receiver end |
.sender ⇒ Object
The sender object is responsible for delivering formatted data to the server.
25 26 27 |
# File 'lib/stilts.rb', line 25 def sender @sender end |
Class Method Details
.configure(silent = false) {|configuration| ... } ⇒ Object
34 35 36 37 38 39 |
# File 'lib/stilts.rb', line 34 def configure(silent = false) self.configuration ||= Configuration.new yield(configuration) self.sender = Sender.new(configuration) self.receiver = Receiver.new(configuration) end |
.environment_info ⇒ Object
Returns the Ruby version, Rails version, and current Rails environment
56 57 58 59 |
# File 'lib/stilts.rb', line 56 def environment_info info = "[Ruby: #{RUBY_VERSION}]" info << " [#{configuration.framework}]" end |
.logger ⇒ Object
41 42 43 |
# File 'lib/stilts.rb', line 41 def logger self.configuration.logger end |
.report_environment_info ⇒ Object
Prints out the environment info to the log for debugging help
46 47 48 |
# File 'lib/stilts.rb', line 46 def report_environment_info write_verbose_log("Environment Info: #{environment_info}") end |
.report_response_body(response) ⇒ Object
Prints out the response body from Stilts for debugging help
51 52 53 |
# File 'lib/stilts.rb', line 51 def report_response_body(response) write_verbose_log("Response from Server: \n#{response}") end |
.write_verbose_log(message) ⇒ Object
Writes out the given message to the #logger
62 63 64 |
# File 'lib/stilts.rb', line 62 def write_verbose_log() logger.info LOG_PREFIX + if logger end |