Class: ControllerWithFeatureCategory::Config

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/concerns/controller_with_feature_category/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category, only, except, if_proc, unless_proc) ⇒ Config

Returns a new instance of Config.


7
8
9
10
11
# File 'app/controllers/concerns/controller_with_feature_category/config.rb', line 7

def initialize(category, only, except, if_proc, unless_proc)
  @category = category.to_sym
  @only, @except = only&.map(&:to_s), except&.map(&:to_s)
  @if_proc, @unless_proc = if_proc, unless_proc
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category


5
6
7
# File 'app/controllers/concerns/controller_with_feature_category/config.rb', line 5

def category
  @category
end

Instance Method Details

#matches?(action) ⇒ Boolean

Returns:

  • (Boolean)

13
14
15
16
# File 'app/controllers/concerns/controller_with_feature_category/config.rb', line 13

def matches?(action)
  included?(action) && !excluded?(action) &&
    if_proc?(action) && !unless_proc?(action)
end