Class: Ruboty::Dsl

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

Overview

Dsl

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDsl

Returns a new instance of Dsl.



29
30
31
32
33
34
35
36
37
# File 'lib/ruboty/dsl/dsl.rb', line 29

def initialize
  @ruboty_generator = Ruboty::DslModel.new
  @ruboty_generator.user_name = 'your github username'
  @ruboty_generator.gem_class_name = 'your_gem_class_name'
  @ruboty_generator.gem_name = 'your_gem_name'
  @ruboty_generator.description = 'description'
  @ruboty_generator.env = []
  @ruboty_generator.commands = []
end

Instance Attribute Details

#ruboty_generatorObject

Returns the value of attribute ruboty_generator.



9
10
11
# File 'lib/ruboty/dsl/dsl.rb', line 9

def ruboty_generator
  @ruboty_generator
end

Instance Method Details

#command {|c| ... } ⇒ Object

Yields:

  • (c)


23
24
25
26
27
# File 'lib/ruboty/dsl/dsl.rb', line 23

def command
  c = Ruboty::Models::Command.new
  yield(c)
  @ruboty_generator.commands << c
end

#env {|e| ... } ⇒ Object

Yields:

  • (e)


17
18
19
20
21
# File 'lib/ruboty/dsl/dsl.rb', line 17

def env
  e = Ruboty::Models::Env.new
  yield(e)
  @ruboty_generator.env << e
end

#to_sObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/ruboty/dsl/dsl.rb', line 39

def to_s
  "user_name = \#{@ruboty_generator.user_name}\ngem_class_name = \#{@ruboty_generator.gem_class_name}\ngem_name = \#{@ruboty_generator.gem_name}\ndescription = \#{@ruboty_generator.description}\nenv = \#{@ruboty_generator.env}\ncommands = \#{@ruboty_generator.commands}\n  EOS\nend\n"