Module: Ronflex

Defined in:
lib/ronflex/rule.rb,
lib/ronflex.rb,
lib/ronflex/rest.rb,
lib/ronflex/errors.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, Error, Railtie, Rest, RonflexArgumentError, Rule

Constant Summary collapse

VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.configurationRonflex::Configuration

Accesses global configuration

Returns:



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

def configuration
  @configuration ||= Configuration.new
end

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

Method to configure ‘Ronflex` with a block

Yields:

  • (config)

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

Yield Parameters:



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

def configure
  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