Module: EffectiveStyleGuide

Defined in:
lib/effective_style_guide.rb,
lib/effective_style_guide/engine.rb,
lib/effective_style_guide/version.rb,
lib/generators/effective_style_guide/install_generator.rb

Defined Under Namespace

Modules: Generators Classes: Engine

Constant Summary collapse

VERSION =
'1.5.3'.freeze

Class Method Summary collapse

Class Method Details

.authorized?(controller, action, resource) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
# File 'lib/effective_style_guide.rb', line 15

def self.authorized?(controller, action, resource)
  if authorization_method.respond_to?(:call) || authorization_method.kind_of?(Symbol)
    raise Effective::AccessDenied.new() unless (controller || self).instance_exec(controller, action, resource, &authorization_method)
  end
  true
end

.colorsObject



22
23
24
# File 'lib/effective_style_guide.rb', line 22

def self.colors
  ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet', 'black', 'white', 'gray']
end

.foodsObject



26
27
28
# File 'lib/effective_style_guide.rb', line 26

def self.foods
  ['Coffee', 'Tea', 'Soda']
end

.grouped_colorsObject



30
31
32
33
34
35
36
# File 'lib/effective_style_guide.rb', line 30

def self.grouped_colors
  {
    'Top' => [['Red', 1], ['Orange', 2], ['Yellow', 3]],
    'Middle' => [['Green', 4], ['Blue', 5], ['Indigo', 6]],
    'Bottom' => [['Violet', 7]]
  }
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



11
12
13
# File 'lib/effective_style_guide.rb', line 11

def self.setup
  yield self
end