Module: Pod::Specification::JSONSupport
- Included in:
- Pod::Specification
- Defined in:
- lib/cocoapods-core/specification/json.rb
Instance Method Summary collapse
-
#safe_to_hash? ⇒ Bool
TODO: remove.
-
#to_hash ⇒ Hash
The hash representation of the specification including subspecs.
-
#to_json(*a) ⇒ String
The json representation of the specification.
-
#to_pretty_json(*a) ⇒ String
The pretty json representation of the specification.
Instance Method Details
#safe_to_hash? ⇒ Bool
TODO: remove
36 37 38 |
# File 'lib/cocoapods-core/specification/json.rb', line 36 def safe_to_hash? true end |
#to_hash ⇒ Hash
Returns the hash representation of the specification including subspecs.
23 24 25 26 27 28 29 |
# File 'lib/cocoapods-core/specification/json.rb', line 23 def to_hash hash = attributes_hash.dup unless subspecs.empty? hash['subspecs'] = subspecs.map(&:to_hash) end hash end |
#to_json(*a) ⇒ String
Returns the json representation of the specification.
6 7 8 9 |
# File 'lib/cocoapods-core/specification/json.rb', line 6 def to_json(*a) require 'json' to_hash.to_json(*a) << "\n" end |
#to_pretty_json(*a) ⇒ String
Returns the pretty json representation of the specification.
13 14 15 16 |
# File 'lib/cocoapods-core/specification/json.rb', line 13 def to_pretty_json(*a) require 'json' JSON.pretty_generate(to_hash, *a) << "\n" end |