Class: Kubes::Compiler::Decorator::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/kubes/compiler/decorator/base.rb

Direct Known Subclasses

Hashable, Post, Pre

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Base

Returns a new instance of Base.



4
5
6
# File 'lib/kubes/compiler/decorator/base.rb', line 4

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/kubes/compiler/decorator/base.rb', line 3

def data
  @data
end

Instance Method Details

#resultObject



13
14
15
16
17
18
19
20
# File 'lib/kubes/compiler/decorator/base.rb', line 13

def result
  if @data.key?(Kubes::Compiler::Dsl::Core::Blocks)
    @data.results.each { |k,v| run(v) } # returns nil
  else
    run # processes and returns @data
  end
  @data # important to return @data so we keep the original @data structure: Blocks or Hash
end

#runObject



8
9
10
11
# File 'lib/kubes/compiler/decorator/base.rb', line 8

def run
  return @data unless Kubes.config.suffix_hash
  process
end