Class: KBuilder::Dotnet::CodeBlock

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

Overview

Represents some code that you wish to inject into a template.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, namespaces = []) ⇒ CodeBlock

Returns a new instance of CodeBlock.



11
12
13
14
15
16
# File 'lib/k_builder/dotnet/code_block.rb', line 11

def initialize(code, namespaces = [])
  @code = code
  @namespaces = namespaces

  raise KBuilder::Dotnet::Error, 'Code cannot be nil' if code.nil?
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



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

def code
  @code
end

#namespacesObject

Returns the value of attribute namespaces.



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

def namespaces
  @namespaces
end