Class: HelpAnywhere::Configuration
- Inherits:
-
Object
- Object
- HelpAnywhere::Configuration
- Defined in:
- lib/help-anywhere/configuration.rb
Instance Attribute Summary collapse
-
#edition_role ⇒ Object
Returns the value of attribute edition_role.
Instance Method Summary collapse
- #has_edition_role?(scope) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #render_routes ⇒ Object
- #routes {|@routes| ... } ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
33 34 35 36 |
# File 'lib/help-anywhere/configuration.rb', line 33 def initialize @routes = HelpAnywhere::Routes.new @edition_role = lambda{ true } #per default, we need no authentication to edit help resources end |
Instance Attribute Details
#edition_role ⇒ Object
Returns the value of attribute edition_role.
13 14 15 |
# File 'lib/help-anywhere/configuration.rb', line 13 def edition_role @edition_role end |
Instance Method Details
#has_edition_role?(scope) ⇒ Boolean
15 16 17 18 19 20 21 |
# File 'lib/help-anywhere/configuration.rb', line 15 def has_edition_role? scope if edition_role.instance_of?(Proc) edition_role.bind(scope).call else scope.send(edition_role.to_s.to_sym) end end |
#render_routes ⇒ Object
29 30 31 |
# File 'lib/help-anywhere/configuration.rb', line 29 def render_routes @routes.to_javascript end |
#routes {|@routes| ... } ⇒ Object
23 24 25 26 27 |
# File 'lib/help-anywhere/configuration.rb', line 23 def routes yield @routes if block_given? @routes end |