Class: Aygabtu::Scope::Base
- Inherits:
-
Object
- Object
- Aygabtu::Scope::Base
show all
- Includes:
- [
NamespaceController,
Action,
Named,
VisitingWith,
Requiring,
StaticDynamic,
Remaining
], BasicBehaviour
- Defined in:
- lib/aygabtu/scope/base.rb
Defined Under Namespace
Modules: BasicBehaviour
Constant Summary
collapse
- COMPONENTS =
[
NamespaceController,
Action,
Named,
VisitingWith,
Requiring,
StaticDynamic,
Remaining
]
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#inspect_data, #matches_route?, #segments_split_once
Constructor Details
#initialize(data) ⇒ Base
12
13
14
|
# File 'lib/aygabtu/scope/base.rb', line 12
def initialize(data)
@data = data
end
|
Class Attribute Details
.factory_methods ⇒ Object
Returns the value of attribute factory_methods.
75
76
77
|
# File 'lib/aygabtu/scope/base.rb', line 75
def factory_methods
@factory_methods
end
|
Class Method Details
.blank_slate ⇒ Object
20
21
22
|
# File 'lib/aygabtu/scope/base.rb', line 20
def self.blank_slate
new(filters: [])
end
|
Instance Method Details
#inspect ⇒ Object
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/aygabtu/scope/base.rb', line 61
def inspect
data = inspect_data
data.keys.each { |key| data.delete(key) if data[key].nil? }
message = if data.empty?
"nothing specified"
else
data.map { |key, value| "#{key}: #{value}" }.join(', ')
end
"\#<Aygabtu scope (#{message})>"
end
|
#segments ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/aygabtu/scope/base.rb', line 53
def segments
if split_once = segments_split_once
split_once.map(&:segments).reduce(:+)
else
[self]
end
end
|
#visiting_data ⇒ Object
16
17
18
|
# File 'lib/aygabtu/scope/base.rb', line 16
def visiting_data
@data.fetch(:visiting_data, {})
end
|