Class: APIBuilder::DSL
- Inherits:
-
Object
- Object
- APIBuilder::DSL
- Defined in:
- bin/minecraftctlserver
Defined Under Namespace
Classes: OP
Instance Method Summary collapse
- #data ⇒ Object
- #get(name, description, &block) ⇒ Object
-
#initialize(sinatra, path, &block) ⇒ DSL
constructor
A new instance of DSL.
- #path(name, description, &block) ⇒ Object
- #post(name, description, &block) ⇒ Object
Constructor Details
#initialize(sinatra, path, &block) ⇒ DSL
Returns a new instance of DSL.
98 99 100 101 102 103 104 105 106 107 |
# File 'bin/minecraftctlserver', line 98 def initialize(sinatra, path, &block) @sinatra = sinatra @path = path @gets = [] @posts = [] @paths = [] instance_eval(&block) end |
Instance Method Details
#data ⇒ Object
109 110 111 |
# File 'bin/minecraftctlserver', line 109 def data Struct.new(:gets, :posts, :paths).new(@gets, @posts, @paths) end |
#get(name, description, &block) ⇒ Object
113 114 115 |
# File 'bin/minecraftctlserver', line 113 def get(name, description, &block) @gets << OP.new(name, description, block) end |
#path(name, description, &block) ⇒ Object
121 122 123 |
# File 'bin/minecraftctlserver', line 121 def path(name, description, &block) @paths << APIBuilder.new(@sinatra, description, @path + '/' + name, &block) end |