Class: Mixlib::JSON::ActiveSupport
- Inherits:
-
Object
- Object
- Mixlib::JSON::ActiveSupport
- Defined in:
- lib/mixlib/json/activesupport.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.is_loaded? ⇒ Boolean
27 28 29 |
# File 'lib/mixlib/json/activesupport.rb', line 27 def is_loaded? Object.const_defined?("ActiveSupport") end |
.load ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/mixlib/json/activesupport.rb', line 31 def load begin require 'active_support/json' self.new rescue LoadError false end end |
Instance Method Details
#generate(obj) ⇒ Object
41 42 43 |
# File 'lib/mixlib/json/activesupport.rb', line 41 def generate(obj) ::ActiveSupport::JSON.encode(obj) end |
#parse(obj) ⇒ Object
49 50 51 |
# File 'lib/mixlib/json/activesupport.rb', line 49 def parse(obj) ::ActiveSupport::JSON.decode(obj) end |
#pretty(obj) ⇒ Object
45 46 47 |
# File 'lib/mixlib/json/activesupport.rb', line 45 def pretty(obj) ::ActiveSupport::JSON.encode(obj) end |