Module: RocketPants

Defined in:
lib/rocket_pants/active_record.rb,
lib/rocket_pants.rb,
lib/rocket_pants/base.rb,
lib/rocket_pants/error.rb,
lib/rocket_pants/client.rb,
lib/rocket_pants/errors.rb,
lib/rocket_pants/railtie.rb,
lib/rocket_pants/routing.rb,
lib/rocket_pants/cacheable.rb,
lib/rocket_pants/test_helper.rb,
lib/rocket_pants/rspec_matchers.rb,
lib/rocket_pants/cache_middleware.rb,
lib/rocket_pants/controller/jsonp.rb,
lib/rocket_pants/controller/caching.rb,
lib/rocket_pants/controller/linking.rb,
lib/rocket_pants/controller/url_for.rb,
lib/rocket_pants/controller/rescuable.rb,
lib/rocket_pants/controller/versioning.rb,
lib/rocket_pants/controller/respondable.rb,
lib/rocket_pants/controller/error_handling.rb,
lib/rocket_pants/controller/header_metadata.rb,
lib/rocket_pants/controller/instrumentation.rb,
lib/rocket_pants/controller/strong_parameters.rb,
lib/rocket_pants/controller/format_verification.rb

Overview

Provides a bunch of default active record integration entry points.

Defined Under Namespace

Modules: ActiveRecordIntegration, Cacheable, Caching, ErrorHandling, FormatVerification, HeaderMetadata, Instrumentation, JSONP, Linking, RSpecMatchers, Rescuable, Respondable, Routing, StrongParameters, TestHelper, UrlFor, Versioning Classes: Base, CacheMiddleware, Client, Error, Errors, InvalidResource, Railtie

Class Method Summary collapse

Class Method Details

.cacheObject



63
64
65
# File 'lib/rocket_pants.rb', line 63

def cache
  @@cache ||= (MONETA_LEGACY ? Moneta::Memory : Moneta::Adapters::Memory).new
end

.default_envObject



86
87
88
89
90
# File 'lib/rocket_pants.rb', line 86

def default_env
  env = Rails.env.to_s if defined?(Rails.env)
  env ||= ENV['RAILS_ENV'].presence || ENV['RACK_ENV'].presence || "development"
  ActiveSupport::StringInquirer.new env
end

.default_pass_through_errorsObject



92
93
94
# File 'lib/rocket_pants.rb', line 92

def default_pass_through_errors
  env.development? || env.test?
end

.default_show_exception_messageObject



96
97
98
# File 'lib/rocket_pants.rb', line 96

def default_show_exception_message
  env.development? || env.test?
end

.envObject



67
68
69
# File 'lib/rocket_pants.rb', line 67

def env
  @@env ||= default_env
end

.env=(value) ⇒ Object



71
72
73
74
# File 'lib/rocket_pants.rb', line 71

def env=(value)
  value = value.presence && ActiveSupport::StringInquirer.new(value)
  @@env = value
end

.pass_through_errorsObject Also known as: pass_through_errors?



100
101
102
103
104
105
106
# File 'lib/rocket_pants.rb', line 100

def pass_through_errors
  if defined?(@@pass_through_errors) && [true, false].include?(@@pass_through_errors)
    @@pass_through_errors
  else
    @@pass_through_errors = default_pass_through_errors
  end
end

.pass_through_errors=(value) ⇒ Object



109
110
111
# File 'lib/rocket_pants.rb', line 109

def pass_through_errors=(value)
  @@pass_through_errors = value
end

.show_exception_message=(value) ⇒ Object



82
83
84
# File 'lib/rocket_pants.rb', line 82

def show_exception_message=(value)
  @@show_exception_message = value
end

.show_exception_message?Boolean Also known as: show_exception_message

Returns:

  • (Boolean)


76
77
78
79
# File 'lib/rocket_pants.rb', line 76

def show_exception_message?
  @@show_exception_message = default_show_exception_message if !defined?(@@show_exception_message) || @@show_exception_message.nil?
  @@show_exception_message
end