Class: Yoda::Cli::AnalyzeDeps::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/cli/analyze_deps.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_path) ⇒ Builder

Returns a new instance of Builder.

Parameters:

  • root_path (String)


18
19
20
# File 'lib/yoda/cli/analyze_deps.rb', line 18

def initialize(root_path)
  @root_path = root_path
end

Instance Attribute Details

#root_pathString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/yoda/cli/analyze_deps.rb', line 15

def root_path
  @root_path
end

Instance Method Details

#gemsArray<Yoda::Store::Objects::Library::Gem>



23
24
25
# File 'lib/yoda/cli/analyze_deps.rb', line 23

def gems
  @gems ||= dependency_specs.map { |spec| Yoda::Store::Objects::Library::Gem.from_gem_spec(spec) }
end

#to_hObject



27
28
29
30
31
32
# File 'lib/yoda/cli/analyze_deps.rb', line 27

def to_h
  {
    path: root_path,
    dependencies: gems.map(&:to_h),
  }
end

#to_jsonObject



34
35
36
# File 'lib/yoda/cli/analyze_deps.rb', line 34

def to_json(*)
  to_h.to_json
end