Class: HelpAnywhere::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/help-anywhere/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_roleObject

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

Returns:

  • (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_routesObject



29
30
31
# File 'lib/help-anywhere/configuration.rb', line 29

def render_routes
  @routes.to_javascript
end

#routes {|@routes| ... } ⇒ Object

Yields:



23
24
25
26
27
# File 'lib/help-anywhere/configuration.rb', line 23

def routes
  yield @routes if block_given?

  @routes
end