module SimpleAnnotation::Annotatable::ClassMethods

Public Instance Methods

annotated?(meth, with: nil) click to toggle source
# File lib/simple_annotation/annotatable.rb, line 24
def annotated?(meth, with: nil)
  return @__method_to_annotations.include?(meth.to_sym) if with.nil?

  @__method_to_annotations[meth.to_sym].include? with
end
annotates(*method_or_annotations, with: nil) click to toggle source
# File lib/simple_annotation/annotatable.rb, line 14
def annotates(*method_or_annotations, with: nil)
  if with.nil?
    @__standby_annotations.concat(method_or_annotations)
  else
    method_or_annotations.each do |meth|
      @__method_to_annotations[meth.to_sym] << with
    end
  end
end
annotations(meth) click to toggle source
# File lib/simple_annotation/annotatable.rb, line 30
def annotations(meth)
  @__method_to_annotations[meth.to_sym].to_a
end

Private Instance Methods

method_added(meth) click to toggle source
Calls superclass method
# File lib/simple_annotation/annotatable.rb, line 36
def method_added(meth)
  super

  @__standby_annotations.each do |annotation|
    annotates meth, with: annotation
  end
  @__standby_annotations.clear
end