class SpaceStation::Station
Public Class Methods
new(app, options = {})
click to toggle source
# File lib/space_station.rb, line 7 def initialize(app, options = {}) @app = app @ascii_art = self.class.name.split('::').last.gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase @msg = options.fetch(:msg, nil) end
Public Instance Methods
call(env)
click to toggle source
# File lib/space_station.rb, line 14 def call(env) to_write = @msg || IO.read("#{SpaceStation::ASCII_PATH}/#{@ascii_art}") rescue '' log_before_response(to_write) @app.call(env) end
Protected Instance Methods
log_before_response(to_write)
click to toggle source
# File lib/space_station.rb, line 23 def log_before_response(to_write) puts "*" * 69 puts self.class.name puts "VS" puts @ascii_art puts to_write # begin # puts IO.read("#{SpaceStation::ASCII_PATH}/#{to_write}") # rescue # puts '' # end end