Module: JSONAPIonify
- Extended by:
- Autoload
- Defined in:
- lib/jsonapionify.rb,
lib/jsonapionify/version.rb,
lib/jsonapionify/autoload.rb,
lib/jsonapionify/callbacks.rb,
lib/jsonapionify/structure.rb,
lib/jsonapionify/continuation.rb,
lib/jsonapionify/documentation.rb,
lib/jsonapionify/api/test_helper.rb,
lib/jsonapionify/character_range.rb,
lib/jsonapionify/indented_string.rb,
lib/jsonapionify/api/errors_object.rb,
lib/jsonapionify/deep_sort_collection.rb,
lib/jsonapionify/inherited_attributes.rb
Defined Under Namespace
Modules: Api, Autoload, Callbacks, DeepSortCollection, DestructuredProc, IndentedString, InheritedAttributes, Structure, Types
Classes: CharacterRange, Continuation, CustomRescue, Documentation
Constant Summary
collapse
- TRUTHY_STRINGS =
%w(t true y yes 1).flat_map do |str|
[str.downcase, str.upcase, str.capitalize]
end.uniq
- FALSEY_STRINGS =
%w(f false n no 0).flat_map do |str|
[str.downcase, str.upcase, str.capitalize]
end.uniq
- VERSION =
"0.12.5"
Class Method Summary
collapse
Methods included from Autoload
autoload_all, eager_load!, unloaded
Class Method Details
.cache(store, *args) ⇒ Object
35
36
37
|
# File 'lib/jsonapionify.rb', line 35
def self.cache(store, *args)
self.cache_store = ActiveSupport::Cache.lookup_store(store, *args)
end
|
.cache_store ⇒ Object
83
84
85
|
# File 'lib/jsonapionify.rb', line 83
def self.cache_store
@cache_store ||= ActiveSupport::Cache.lookup_store :null_store
end
|
.cache_store=(store) ⇒ Object
71
72
73
|
# File 'lib/jsonapionify.rb', line 71
def self.cache_store=(store)
@cache_store = store
end
|
.digest ⇒ Object
39
40
41
42
43
|
# File 'lib/jsonapionify.rb', line 39
def self.digest
@digest ||= Digest::SHA2.hexdigest(
Dir.glob(File.join __dir__, '**/*.rb').map { |f| File.read f }.join
)
end
|
.disable_validation(bool) ⇒ Object
75
76
77
|
# File 'lib/jsonapionify.rb', line 75
def self.disable_validation(bool)
@validation_disabled = bool
end
|
.logger ⇒ Object
67
68
69
|
# File 'lib/jsonapionify.rb', line 67
def self.logger
@logger ||= defined?(Rails) ? Rails.logger : Logger.new('/dev/null')
end
|
.logger=(logger) ⇒ Object
63
64
65
|
# File 'lib/jsonapionify.rb', line 63
def self.logger=(logger)
@logger = logger
end
|
.new_object(*args) ⇒ Object
31
32
33
|
# File 'lib/jsonapionify.rb', line 31
def self.new_object(*args)
Structure::Objects::TopLevel.new(*args)
end
|
.parse(hash) ⇒ Object
26
27
28
29
|
# File 'lib/jsonapionify.rb', line 26
def self.parse(hash)
hash = Oj.load(hash) if hash.is_a? String
Structure::Objects::TopLevel.from_hash(hash)
end
|
.path ⇒ Object
22
23
24
|
# File 'lib/jsonapionify.rb', line 22
def self.path
__dir__
end
|
.show_backtrace ⇒ Object
58
59
60
61
|
# File 'lib/jsonapionify.rb', line 58
def self.show_backtrace
return @show_backtrace if instance_variable_defined?(:@show_backtrace)
self.show_backtrace = ENV['RACK_ENV'] != 'production'
end
|
.show_backtrace=(value) ⇒ Object
54
55
56
|
# File 'lib/jsonapionify.rb', line 54
def self.show_backtrace=(value)
@show_backtrace = value
end
|
.validation_disabled? ⇒ Boolean
79
80
81
|
# File 'lib/jsonapionify.rb', line 79
def self.validation_disabled?
!!@validation_disabled
end
|
.verbose_errors ⇒ Object
49
50
51
52
|
# File 'lib/jsonapionify.rb', line 49
def self.verbose_errors
return @verbose_errors if instance_variable_defined?(:@verbose_errors)
self.verbose_errors = ENV['RACK_ENV'] != 'production'
end
|
.verbose_errors=(value) ⇒ Object
45
46
47
|
# File 'lib/jsonapionify.rb', line 45
def self.verbose_errors=(value)
self.show_backtrace = @verbose_errors = value
end
|