Module: Ki::Annotations

Defined in:
lib/ki/utils/annotations.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object (private)



19
20
21
22
23
# File 'lib/ki/utils/annotations.rb', line 19

def method_missing(meth, *args)
  return super unless /\A_/.match?(meth)
  @__last_annotation__ ||= {}
  @__last_annotation__[meth[1..-1].to_sym] = args.size == 1 ? args.first : args
end

Instance Method Details

#annotations(meth = nil) ⇒ Object



6
7
8
9
# File 'lib/ki/utils/annotations.rb', line 6

def annotations(meth = nil)
  return @__annotations__[meth] if meth
  @__annotations__
end