Class: Satis::Configuration

Inherits:
Object
  • Object
show all
Includes:
Options
Defined in:
lib/satis/configuration.rb

Instance Method Summary collapse

Methods included from Options

included, #set_defaults!

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



48
49
50
# File 'lib/satis/configuration.rb', line 48

def initialize
  set_defaults!
end

Instance Method Details

#help_scope(template, object, additional_scope, action: nil) ⇒ Object

Maybe not the right place?



53
54
55
56
57
58
59
60
61
# File 'lib/satis/configuration.rb', line 53

def help_scope(template, object, additional_scope, action: nil)
  scope = template.controller.controller_path.split("/")
  scope << (action || template.controller.action_name)
  scope << object.class.name.demodulize.tableize.singularize

  scope += Array.wrap(additional_scope) if additional_scope

  scope.map(&:to_s)
end

#help_scopes(template, object, additional_scope) ⇒ Object



63
64
65
66
67
68
69
70
# File 'lib/satis/configuration.rb', line 63

def help_scopes(template, object, additional_scope)
  actions = [template.controller.action_name]
  %w[show new edit create update destroy index].each do |action|
    actions << action unless actions.include?(action)
  end

  actions.map { |action| help_scope(template, object, additional_scope, action: action) }
end