Class: Annotations::Annotator

Inherits:
Object
  • Object
show all
Defined in:
lib/spiderfw/utils/annotations.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(owner) ⇒ Annotator

Returns a new instance of Annotator.



68
69
70
71
72
73
74
# File 'lib/spiderfw/utils/annotations.rb', line 68

def initialize(owner) 
    @owner = owner
    @annotations = {}
    @pending_annotations = []
    @m_pending_annotations = []
    @pending = @pending_annotations
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



85
86
87
# File 'lib/spiderfw/utils/annotations.rb', line 85

def method_missing(name, *args)
    @pending << [name, args]
end

Instance Method Details

#annotate(method_name, *args) ⇒ Object



89
90
91
# File 'lib/spiderfw/utils/annotations.rb', line 89

def annotate(method_name, *args)
    @owner.annotations[method_name] = args
end

#clear_pendingObject



81
82
83
# File 'lib/spiderfw/utils/annotations.rb', line 81

def clear_pending
    @pending_annotations.clear
end

#multipleObject



98
99
100
101
# File 'lib/spiderfw/utils/annotations.rb', line 98

def multiple
    @pending = @m_pending_annotations
    return self
end

#pendingObject



76
77
78
79
# File 'lib/spiderfw/utils/annotations.rb', line 76

def pending
    r = @m_pending_annotations + @pending_annotations
    return r
end

#singleObject



93
94
95
96
# File 'lib/spiderfw/utils/annotations.rb', line 93

def single
    @pending = @pending_annotations
    return self
end