Class: KBuilder::Dotnet::Snippets
- Inherits:
-
Object
- Object
- KBuilder::Dotnet::Snippets
- 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
-
#code_blocks ⇒ Object
Returns the value of attribute code_blocks.
-
#use_namespaces ⇒ Object
Returns the value of attribute use_namespaces.
Instance Method Summary collapse
-
#initialize(code_blocks) ⇒ Snippets
constructor
A new instance of Snippets.
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_blocks ⇒ Object
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_namespaces ⇒ Object
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 |