Module: Accord::Declarations
- Defined in:
- lib/accord/declarations.rb
Defined Under Namespace
Classes: Declaration, Implements
Class Method Summary
collapse
Class Method Details
.also_provides(object, *interfaces) ⇒ Object
122
123
124
|
# File 'lib/accord/declarations.rb', line 122
def also_provides(object, *interfaces)
directly_provides(object, directly_provided_by(object), *interfaces)
end
|
.directly_provided_by(object) ⇒ Object
96
97
98
99
100
|
# File 'lib/accord/declarations.rb', line 96
def directly_provided_by(object)
object.instance_eval do
@_accord_provides_ ||= Declaration.new
end
end
|
.directly_provides(object, *interfaces) ⇒ Object
116
117
118
119
120
|
# File 'lib/accord/declarations.rb', line 116
def directly_provides(object, *interfaces)
object.instance_eval do
@_accord_provides_ = Declaration.new(interfaces)
end
end
|
.implemented_by(factory) ⇒ Object
102
103
104
105
106
|
# File 'lib/accord/declarations.rb', line 102
def implemented_by(factory)
factory.instance_eval do
@_accord_implements_ ||= Implements.new(self)
end
end
|
.implements(cls, *interfaces) ⇒ Object
108
109
110
|
# File 'lib/accord/declarations.rb', line 108
def implements(cls, *interfaces)
implemented_by(cls).declare(*interfaces)
end
|
.implements_only(cls, *interfaces) ⇒ Object
112
113
114
|
# File 'lib/accord/declarations.rb', line 112
def implements_only(cls, *interfaces)
implemented_by(cls).declare_only(*interfaces)
end
|
.no_longer_provides(object, interface) ⇒ Object
126
127
128
|
# File 'lib/accord/declarations.rb', line 126
def no_longer_provides(object, interface)
directly_provides(object, directly_provided_by(object) - interface)
end
|
.provided_by(object) ⇒ Object
92
93
94
|
# File 'lib/accord/declarations.rb', line 92
def provided_by(object)
implemented_by(object.class) + directly_provided_by(object)
end
|