Module: Juke

Extended by:
Juke
Included in:
Juke
Defined in:
lib/juke/ext/utils.rb,
lib/juke.rb,
lib/juke/api.rb,
lib/juke/adapters/rack.rb,
lib/juke/adapters/rails.rb,
lib/juke/formatters/json.rb

Overview

These are ripped directly out of ActiveSupport.

Defined Under Namespace

Modules: API, Adapters, Ext, Formatters

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appObject



13
14
15
16
# File 'lib/juke/adapters/rack.rb', line 13

def app
  raise("You must specify the Rack application with Juke.app = MyApp to use Juke with Rack") unless @app
  @app
end

Instance Method Details

#adapterObject



22
23
24
# File 'lib/juke.rb', line 22

def adapter
  @adapter ||= default_adapter.new
end

#adapter=(adapter) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/juke.rb', line 7

def adapter=(adapter)
  adapter = adapter.to_s
  
  begin
    require "juke/adapters/#{adapter}"
  rescue LoadError
    puts "The adapter `#{adapter}` could not be found (juke/adapters/#{adapter})"
    exit
  end
  
  camelcase_adapter = Juke::Ext::Utils.camelize(adapter)
  adapter_const = Juke::Ext::Utils.constantize("Juke::Adapters::#{camelcase_adapter}")
  @adapter = adapter_const.new
end

#formatterObject



41
42
43
# File 'lib/juke.rb', line 41

def formatter
  @formatter ||= default_formatter.new
end

#formatter=(formatter) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/juke.rb', line 26

def formatter=(formatter)
  formatter = formatter.to_s
  
  begin
    require "juke/formatters/#{formatter}"
  rescue LoadError
    puts "The formatter `#{formatter.to_s}` could not be found (juke/formatters/#{formatter})"
    exit
  end
  
  camelcase_formatter = Juke::Ext::Utils.camelize(formatter)
  formatter_const = Juke::Ext::Utils.constantize("Juke::Formatters::#{camelcase_formatter}")
  @formatter = formatter_const.new
end