Class: LgPodPlugin::LPodTarget

Inherits:
Object
  • Object
show all
Defined in:
lib/lg_pod_plugin/config/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ LPodTarget

Returns a new instance of LPodTarget.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/lg_pod_plugin/config/target.rb', line 7

def initialize(target)
  internal_hash = target.send(:internal_hash)
  @name = internal_hash["name"]
  array = Array.new(internal_hash['dependencies'] ||= [])
  dependencies = array.reject do |e|
    if LUtils.is_a_string?(e)
      true
    elsif e.is_a?(Hash)
      key = e.keys.last ||= ""
      val = e[key].last ||= ""
      !val.is_a?(Hash)
    else
      true
    end
  end
  external_pods = Hash.new
  dependencies.each do |e|
    key = e.keys.last ||= ""
    val = e[key].last ||= {}
    next unless val.is_a?(Hash)
    pod = ExternalPod.new(self, key, val)
    external_pods[pod.name] = pod
  end
  @dependencies = external_pods
end

Instance Attribute Details

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



6
7
8
# File 'lib/lg_pod_plugin/config/target.rb', line 6

def dependencies
  @dependencies
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/lg_pod_plugin/config/target.rb', line 5

def name
  @name
end