Class: KBuilder::Dotnet::Snippets

Inherits:
Object
  • Object
show all
Defined in:
lib/k_builder/dotnet/code_snippets.rb

Overview

Denormalized view of dot net code including use namespaces and nuget/project dependencies that would be needed for a single line of code.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code_blocks) ⇒ Snippets

Returns a new instance of Snippets.



11
12
13
14
15
16
17
18
19
# File 'lib/k_builder/dotnet/code_snippets.rb', line 11

def initialize(code_blocks)
  @code_blocks = code_blocks
  @use_namespaces = code_blocks.namespaces.map(&:namespace).uniq

  # dependencies = code_blocks.map(&:namespaces).flat_map(&:dependencies)

  # @packages = dependencies.select { |d| d.type == :nuget }.uniq
  # @references = dependencies.select { |d| d.type == :reference }.uniq
end

Instance Attribute Details

#code_blocksObject

Returns the value of attribute code_blocks.



8
9
10
# File 'lib/k_builder/dotnet/code_snippets.rb', line 8

def code_blocks
  @code_blocks
end

#use_namespacesObject

Returns the value of attribute use_namespaces.



9
10
11
# File 'lib/k_builder/dotnet/code_snippets.rb', line 9

def use_namespaces
  @use_namespaces
end