Class: DependencySpy::Manifest

Inherits:
Struct
  • Object
show all
Defined in:
lib/dependency_spy/dtos/dependency.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dependenciesObject

Returns the value of attribute dependencies

Returns:

  • (Object)

    the current value of dependencies



19
20
21
# File 'lib/dependency_spy/dtos/dependency.rb', line 19

def dependencies
  @dependencies
end

#kindObject

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



19
20
21
# File 'lib/dependency_spy/dtos/dependency.rb', line 19

def kind
  @kind
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



19
20
21
# File 'lib/dependency_spy/dtos/dependency.rb', line 19

def path
  @path
end

#platformObject

Returns the value of attribute platform

Returns:

  • (Object)

    the current value of platform



19
20
21
# File 'lib/dependency_spy/dtos/dependency.rb', line 19

def platform
  @platform
end

Instance Method Details

#to_json(*args) ⇒ Object



42
43
44
# File 'lib/dependency_spy/dtos/dependency.rb', line 42

def to_json(*args)
  to_map.to_json(*args)
end

#to_mapObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/dependency_spy/dtos/dependency.rb', line 26

def to_map
  map = {}
  members.each do |m|
    if !self[m] ||
       (self[m].is_a?(String) && self[m].empty?) ||
       (self[m].is_a?(Array) && self[m].none?)
      next
    elsif self[m].is_a?(Struct)
      map[m.to_s] = self[m].to_map
    else
      map[m.to_s] = self[m]
    end
  end
  map
end

#to_yaml(*args) ⇒ Object



46
47
48
# File 'lib/dependency_spy/dtos/dependency.rb', line 46

def to_yaml(*args)
  to_map.to_yaml(*args)
end