Module: Zobi
- Defined in:
- lib/zobi.rb,
lib/zobi/engine.rb,
lib/zobi/scoped.rb,
lib/zobi/version.rb,
lib/zobi/discover.rb,
lib/zobi/included.rb,
lib/zobi/decorated.rb,
lib/zobi/inherited.rb,
lib/zobi/paginated.rb,
lib/zobi/controlled_access.rb,
lib/zobi/parameters_sanitizer.rb,
app/decorators/zobi/resource_decorator.rb,
app/decorators/zobi/collection_decorator.rb,
lib/zobi/responders/pagination_responder.rb
Defined Under Namespace
Modules: ControlledAccess, Decorated, Included, Inherited, InstanceMethods, Paginated, Responders, Scoped
Classes: CollectionDecorator, Discover, Engine, ParametersSanitizer, ResourceDecorator
Constant Summary
collapse
- BEHAVIORS =
[:inherited, :scoped, :included, :paginated, :controlled_access, :decorated].freeze
- VERSION =
"4.0.1"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.extended(base) ⇒ Object
8
9
10
|
# File 'lib/zobi.rb', line 8
def self.extended base
base.helper_method :collection, :resource
end
|
Instance Method Details
#behavior_included?(name) ⇒ Boolean
23
24
25
|
# File 'lib/zobi.rb', line 23
def behavior_included? name
ancestors.include?(behavior_module(name))
end
|
#behavior_module(name) ⇒ Object
19
20
21
|
# File 'lib/zobi.rb', line 19
def behavior_module name
"Zobi::#{name.to_s.camelize}".constantize
end
|
#behaviors(*behaviors) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/zobi.rb', line 12
def behaviors *behaviors
(BEHAVIORS & behaviors).each do |behavior|
send(:include, behavior_module(behavior))
end
send(:include, ::Zobi::InstanceMethods)
end
|