Module: Pod::Specification::YAMLSupport
- Included in:
- Pod::Specification
- Defined in:
- lib/cocoapods-core/specification/yaml.rb
Instance Method Summary collapse
-
#has_file_list(spec) ⇒ Bool
If any of the specs uses the FileList class.
-
#safe_to_hash? ⇒ Bool
Whether the specification can be converted to a hash without loss of information.
-
#to_hash ⇒ Hash
The hash representation of the specification including subspecs.
-
#to_yaml ⇒ String
The yaml representation of the specification.
Instance Method Details
#has_file_list(spec) ⇒ Bool
Returns If any of the specs uses the FileList class.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cocoapods-core/specification/yaml.rb', line 29 def has_file_list(spec) result = false all_specs = [ spec, *spec.recursive_subspecs ] all_specs.each do |current_spec| current_spec.available_platforms.each do |platform| consumer = Specification::Consumer.new(current_spec, platform) attributes = DSL.attributes.values.select(&:file_patterns?) attributes.each do |attrb| patterns = consumer.send(attrb.name) if patterns.is_a?(Hash) patterns = patterns.values.flatten(1) end patterns.each do |pattern| if pattern.is_a?(Rake::FileList) result = true end end end end end result end |
#safe_to_hash? ⇒ Bool
Returns Whether the specification can be converted to a hash without loss of information.
23 24 25 |
# File 'lib/cocoapods-core/specification/yaml.rb', line 23 def safe_to_hash? !has_file_list(self) && pre_install_callback.nil? && post_install_callback.nil? end |
#to_hash ⇒ Hash
Returns the hash representation of the specification including subspecs.
14 15 16 17 18 |
# File 'lib/cocoapods-core/specification/yaml.rb', line 14 def to_hash hash = attributes_hash.dup hash["subspecs"] = subspecs.map { |spec| spec.to_hash } unless subspecs.empty? hash end |
#to_yaml ⇒ String
Returns the yaml representation of the specification.
7 8 9 |
# File 'lib/cocoapods-core/specification/yaml.rb', line 7 def to_yaml to_hash.to_yaml end |