Class: Dependency::JsonGenerator::SpecNode
- Inherits:
-
Object
- Object
- Dependency::JsonGenerator::SpecNode
- Defined in:
- lib/cocoapods-dependency-graph/generator/json_generator.rb
Instance Method Summary collapse
-
#initialize(spec) ⇒ SpecNode
constructor
A new instance of SpecNode.
- #spec_brief_info(spec) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(spec) ⇒ SpecNode
Returns a new instance of SpecNode.
48 49 50 51 52 53 54 55 56 |
# File 'lib/cocoapods-dependency-graph/generator/json_generator.rb', line 48 def initialize(spec) @name = spec_brief_info(spec) @dependencies = [] spec.dependencies.each { | dependency | d_spec = JsonGenerator.module_spec_hash[dependency.name] next unless d_spec.source @dependencies << SpecNode.new(d_spec).to_hash } end |
Instance Method Details
#spec_brief_info(spec) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/cocoapods-dependency-graph/generator/json_generator.rb', line 34 def spec_brief_info(spec) spec_brief = Hash.new spec_brief[:name] = spec.name spec_brief[:module_name] = spec.module_name spec_brief[:source] = spec.source spec_brief[:version] = spec.version spec_brief[:homepage] = spec.homepage spec_brief[:local] = spec.local? if spec.source spec_brief[:summary] = spec.root.attributes_hash['summary'] spec_brief[:subspec] = spec.subspecs spec_brief end |
#to_hash ⇒ Object
58 59 60 61 62 63 |
# File 'lib/cocoapods-dependency-graph/generator/json_generator.rb', line 58 def to_hash() res = Hash.new res[:name] = @name res[:dependencies] = @dependencies res end |