Class: Pod::Specification

Inherits:
Object
  • Object
show all
Includes:
Tdfire
Defined in:
lib/cocoapods-tdfire-binary/specification_dsl.rb,
lib/cocoapods-tdfire-binary/binary_specification_refactor.rb

Defined Under Namespace

Modules: DSL

Instance Method Summary collapse

Instance Method Details

#all_array_value_for_attribute(name) ⇒ Object



18
19
20
# File 'lib/cocoapods-tdfire-binary/binary_specification_refactor.rb', line 18

def all_array_value_for_attribute(name)
  all_value_for_attribute(name).flatten
end

#all_hash_value_for_attribute(name) ⇒ Object



14
15
16
# File 'lib/cocoapods-tdfire-binary/binary_specification_refactor.rb', line 14

def all_hash_value_for_attribute(name)
  all_value_for_attribute(name).reduce({}, :merge)
end

#all_value_for_attribute(name) ⇒ Object

——————————————————————–#

> 获取自身以及子组件的属性合并值

——————————————————————–#



8
9
10
11
12
# File 'lib/cocoapods-tdfire-binary/binary_specification_refactor.rb', line 8

def all_value_for_attribute(name)
  (Array(self) + Array(recursive_subspecs))
   .map { |s| s.attributes_hash[name] }
   .compact
end

#store_array_value_with_attribute_and_reference_spec(name, spec) ⇒ Object



22
23
24
25
26
# File 'lib/cocoapods-tdfire-binary/binary_specification_refactor.rb', line 22

def store_array_value_with_attribute_and_reference_spec(name, spec)
  temp = spec.all_array_value_for_attribute(name)
  temp += attributes_hash[name] unless attributes_hash[name].nil?
  store_attribute(name, temp) unless temp.empty?  
end

#store_hash_value_with_attribute_and_reference_spec(name, spec, &select) ⇒ Object



28
29
30
31
32
33
# File 'lib/cocoapods-tdfire-binary/binary_specification_refactor.rb', line 28

def store_hash_value_with_attribute_and_reference_spec(name, spec, &select)
  temp = spec.all_hash_value_for_attribute(name)
  temp.merge!(attributes_hash[name]) unless attributes_hash[name].nil?
temp.select! { |k, v| yield k if block_given? }
  store_attribute(name, temp) unless temp.empty?  
end

#tdfire_refactorObject



9
10
11
# File 'lib/cocoapods-tdfire-binary/specification_dsl.rb', line 9

def tdfire_refactor
  @refactor ||= BinarySpecificationRefactor.new(self)
end