class DependencySpy::Dependency

Public Instance Methods

to_json(*args) click to toggle source
# File lib/dependency_spy/dtos/dependency.rb, line 75
def to_json(*args)
  to_map.to_json(*args)
end
to_map() click to toggle source
# File lib/dependency_spy/dtos/dependency.rb, line 59
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) click to toggle source
# File lib/dependency_spy/dtos/dependency.rb, line 79
def to_yaml(*args)
  to_map.to_yaml(*args)
end