Module: Ronflex

Defined in:
lib/ronflex/rule.rb,
lib/ronflex.rb,
lib/ronflex/rest.rb,
lib/ronflex/version.rb,
lib/ronflex/railties.rb,
lib/ronflex/configuration.rb

Overview

# add rule for guest

config.add_rule(:guest) do |user, request|
  # guests can only acces public path
  request.path.start_with?("/public")
end

# add custom page maintenance
config.maintenance_page = "/path/to/your/custom/maintenance/page.html"

end

Defined Under Namespace

Classes: Configuration, Railtie, Rest, Rule

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.configurationSnorlax::Configuration

Accesses global configuration

Returns:

  • (Snorlax::Configuration)

    The global instance of the configuration



20
21
22
# File 'lib/ronflex.rb', line 20

def configuration
  @configuration ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Method to configure ‘Snorlax` with a block

Yields:

  • (config)

    The block receives an instance of ‘Snorlax::Configuration`

Yield Parameters:

  • config (Snorlax::Configuration)

    The configuration object to modify.



12
13
14
15
# File 'lib/ronflex.rb', line 12

def configure
  @configuration ||= Configuration.new
  yield @configuration if block_given?
end

.play_pokeflutevoid

This method returns an undefined value.

Simulates playing the Pokéflute, disabling a feature.

This method modifies the global configuration to enable a specific feature.



29
30
31
# File 'lib/ronflex.rb', line 29

def play_pokeflute
  configuration.enable = false
end

.stop_pokeflutevoid

This method returns an undefined value.

Simulates stopping the Pokéflute, enabling a feature.

This method modifies the global configuration to disable a specific feature.



38
39
40
# File 'lib/ronflex.rb', line 38

def stop_pokeflute
  configuration.enable = true
end