Class: Catfish::Dsl

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDsl

Returns a new instance of Dsl.



10
11
12
# File 'lib/catfish/dsl.rb', line 10

def initialize
  @servers = []
end

Instance Attribute Details

#serversObject

Returns the value of attribute servers.



8
9
10
# File 'lib/catfish/dsl.rb', line 8

def servers
  @servers
end

Class Method Details

.evaluateObject



3
4
5
6
# File 'lib/catfish/dsl.rb', line 3

def self.evaluate
  builder = new
  builder.eval_catfishfile
end

Instance Method Details

#eval_catfishfileObject



14
15
16
17
18
# File 'lib/catfish/dsl.rb', line 14

def eval_catfishfile
  catfishfile = 'Catfishfile'
  contents = File.read(catfishfile).strip
  instance_eval(contents, catfishfile.to_s, 1)
end

#server(name, *_args) ⇒ Object



20
21
22
# File 'lib/catfish/dsl.rb', line 20

def server(name, *_args)
  servers << name
end