Class: Ec2ssh::Dsl

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2ssh/dsl.rb

Defined Under Namespace

Modules: Parser Classes: Container

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDsl

Returns a new instance of Dsl.



11
12
13
# File 'lib/ec2ssh/dsl.rb', line 11

def initialize
  @_result = Container.new
end

Instance Attribute Details

#_resultObject (readonly)

Returns the value of attribute _result.



6
7
8
# File 'lib/ec2ssh/dsl.rb', line 6

def _result
  @_result
end

Instance Method Details

#aws_keys(keys) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/ec2ssh/dsl.rb', line 15

def aws_keys(keys)
  unless keys.all? {|_, v| v.is_a?(Hash) && v.each_value.all? {|c| CREDENTIAL_CLASSES.any?(&c.method(:is_a?)) } }
    raise DotfileValidationError, <<-MSG
Since v4.0, `aws_keys` in the dotfile must be specified regions as a hash key.
See: https://github.com/mirakui/ec2ssh#how-to-upgrade-from-3x
    MSG
  end
  @_result.aws_keys = keys
end

#filters(filters) ⇒ Object



41
42
43
# File 'lib/ec2ssh/dsl.rb', line 41

def filters(filters)
  @_result.filters = filters
end

#host_line(erb) ⇒ Object



33
34
35
# File 'lib/ec2ssh/dsl.rb', line 33

def host_line(erb)
  @_result.host_line = erb
end

#path(str) ⇒ Object



45
46
47
# File 'lib/ec2ssh/dsl.rb', line 45

def path(str)
  @_result.path = str
end

#profiles(*profiles) ⇒ Object



25
26
27
# File 'lib/ec2ssh/dsl.rb', line 25

def profiles(*profiles)
  @_result.profiles = profiles
end

#regions(*regions) ⇒ Object



29
30
31
# File 'lib/ec2ssh/dsl.rb', line 29

def regions(*regions)
  @_result.regions = regions
end

#reject(&block) ⇒ Object



37
38
39
# File 'lib/ec2ssh/dsl.rb', line 37

def reject(&block)
  @_result.reject = block
end