Module: CasualAPI::Annotation

Defined in:
lib/annotation.rb

Instance Method Summary collapse

Instance Method Details

#as_file(*files) ⇒ Object



7
8
9
10
# File 'lib/annotation.rb', line 7

def as_file *files
  @context_stack.last[:as_file] ||= []
  @context_stack.last[:as_file].push(*files)
end

#clear_annotaionObject



37
38
39
40
41
42
43
44
45
# File 'lib/annotation.rb', line 37

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)
  @context_stack.last.delete(:hide)
end

#description(param1, param2 = nil) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/annotation.rb', line 24

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

#hide(value = true) ⇒ Object



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

def hide(value=true)
  @context_stack.last[:hide] = value
end

#is_array(*params) ⇒ Object



15
16
17
18
# File 'lib/annotation.rb', line 15

def is_array *params
  @context_stack.last[:is_array] ||= []
  @context_stack.last[:is_array].push(*params)
end

#is_file(*files) ⇒ Object



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

def is_file *files
  @context_stack.last[:is_file] ||= []
  @context_stack.last[:is_file].push(*files)
end

#is_hash(*params) ⇒ Object



19
20
21
22
# File 'lib/annotation.rb', line 19

def is_hash *params
  @context_stack.last[:is_hash] ||= []
  @context_stack.last[:is_hash].push(*params)
end

#tempfile(*files) ⇒ Object



11
12
13
14
# File 'lib/annotation.rb', line 11

def tempfile *files
  @context_stack.last[:tempfile] ||= []
  @context_stack.last[:tempfile].push(*files)
end