Class: Piculet::Client

Inherits:
Object
  • Object
show all
Includes:
Logger::ClientHelper
Defined in:
lib/piculet/client.rb

Instance Method Summary collapse

Methods included from Logger::ClientHelper

#log

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



12
13
14
15
# File 'lib/piculet/client.rb', line 12

def initialize(options = {})
  @options = OpenStruct.new(options)
  @options.ec2 = AWS::EC2.new
end

Instance Method Details

#apply(file) ⇒ Object



17
18
19
20
# File 'lib/piculet/client.rb', line 17

def apply(file)
  @options.ec2.owner_id
  AWS.memoize { walk(file) }
end

#exportObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/piculet/client.rb', line 22

def export
  exported = AWS.memoize { Exporter.export(@options.ec2) }

  if block_given?
    converter = proc do |src|
      DSL.convert(src, @options.ec2.owner_id)
    end

    yield(exported, converter)
  else
    DSL.convert(exported, @options.ec2.owner_id)
  end
end