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.



5
6
7
8
9
# File 'lib/piculet/client.rb', line 5

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

Instance Method Details

#apply(file) ⇒ Object



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

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

#export(options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/piculet/client.rb', line 16

def export(options = {})
  exported = AWS.memoize do
    Exporter.export(@options.ec2, @options_hash.merge(options))
  end

  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