Module: CasualAPI::Annotation
- Defined in:
- lib/dsl.rb
Instance Method Summary collapse
- #as_file(*files) ⇒ Object
- #clear_annotaion ⇒ Object
- #description(param1, param2 = nil) ⇒ Object
- #is_array(*params) ⇒ Object
- #is_file(*files) ⇒ Object
- #is_hash(*params) ⇒ Object
- #tempfile(*files) ⇒ Object
Instance Method Details
#as_file(*files) ⇒ Object
144 145 146 147 |
# File 'lib/dsl.rb', line 144 def as_file *files @context_stack.last[:as_file] ||= [] @context_stack.last[:as_file].push(*files) end |
#clear_annotaion ⇒ Object
170 171 172 173 174 175 176 177 |
# File 'lib/dsl.rb', line 170 def clear_annotaion @context_stack.last.delete(:is_file) @context_stack.last.delete(:as_file) @context_stack.last.delete(:tempfile) @context_stack.last.delete(:is_array) @context_stack.last.delete(:is_hash) @context_stack.last.delete(:description) end |
#description(param1, param2 = nil) ⇒ Object
161 162 163 164 165 166 167 168 169 |
# File 'lib/dsl.rb', line 161 def description(param1, param2=nil) @context_stack.last[:description] ||= {} if param2 @context_stack.last[:description][:params] ||= {} @context_stack.last[:description][:params][param1] = param2 else @context_stack.last[:description][:path] = param1 end end |
#is_array(*params) ⇒ Object
152 153 154 155 |
# File 'lib/dsl.rb', line 152 def is_array *params @context_stack.last[:is_array] ||= [] @context_stack.last[:is_array].push(*params) end |
#is_file(*files) ⇒ Object
140 141 142 143 |
# File 'lib/dsl.rb', line 140 def is_file *files @context_stack.last[:is_file] ||= [] @context_stack.last[:is_file].push(*files) end |
#is_hash(*params) ⇒ Object
156 157 158 159 |
# File 'lib/dsl.rb', line 156 def is_hash *params @context_stack.last[:is_hash] ||= [] @context_stack.last[:is_hash].push(*params) end |
#tempfile(*files) ⇒ Object
148 149 150 151 |
# File 'lib/dsl.rb', line 148 def tempfile *files @context_stack.last[:tempfile] ||= [] @context_stack.last[:tempfile].push(*files) end |