Class: Pinnable::Configuration
- Inherits:
-
Object
- Object
- Pinnable::Configuration
- Defined in:
- lib/pinnable/configuration.rb
Overview
The single seam between the engine and its host. Defaults are safe-off: with no configuration the widget never renders and every endpoint 404s, so a host opts in deliberately rather than by accident.
Instance Attribute Summary collapse
-
#anchor_max_bytes ⇒ Object
Returns the value of attribute anchor_max_bytes.
-
#audit ⇒ Object
Returns the value of attribute audit.
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#enabled_for ⇒ Object
Returns the value of attribute enabled_for.
-
#encrypt ⇒ Object
Returns the value of attribute encrypt.
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#parent_controller ⇒ Object
Returns the value of attribute parent_controller.
-
#resolver_label ⇒ Object
Returns the value of attribute resolver_label.
-
#tenant_scope ⇒ Object
Returns the value of attribute tenant_scope.
-
#user_label ⇒ Object
Returns the value of attribute user_label.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pinnable/configuration.rb', line 9 def initialize @enabled_for = ->(_user) { false } # the gate @current_user = ->(_controller) { nil } # host's auth @tenant_scope = ->(_controller) { nil } # optional multitenancy @user_label = ->(user) { user.try(:email) || user.try(:name) || user.to_s } @resolver_label = @user_label @parent_controller = "ActionController::Base" # inherit host auth/CSRF/layout @encrypt = false # opt-in AR encryption of body/anchor @audit = ->(_pin, _event, _by) {} # optional sink @anchor_max_bytes = 50_000 @layout = "pinnable/application" # host sets its own for native chrome end |
Instance Attribute Details
#anchor_max_bytes ⇒ Object
Returns the value of attribute anchor_max_bytes.
6 7 8 |
# File 'lib/pinnable/configuration.rb', line 6 def anchor_max_bytes @anchor_max_bytes end |
#audit ⇒ Object
Returns the value of attribute audit.
6 7 8 |
# File 'lib/pinnable/configuration.rb', line 6 def audit @audit end |
#current_user ⇒ Object
Returns the value of attribute current_user.
6 7 8 |
# File 'lib/pinnable/configuration.rb', line 6 def current_user @current_user end |
#enabled_for ⇒ Object
Returns the value of attribute enabled_for.
6 7 8 |
# File 'lib/pinnable/configuration.rb', line 6 def enabled_for @enabled_for end |
#encrypt ⇒ Object
Returns the value of attribute encrypt.
6 7 8 |
# File 'lib/pinnable/configuration.rb', line 6 def encrypt @encrypt end |
#layout ⇒ Object
Returns the value of attribute layout.
6 7 8 |
# File 'lib/pinnable/configuration.rb', line 6 def layout @layout end |
#parent_controller ⇒ Object
Returns the value of attribute parent_controller.
6 7 8 |
# File 'lib/pinnable/configuration.rb', line 6 def parent_controller @parent_controller end |
#resolver_label ⇒ Object
Returns the value of attribute resolver_label.
6 7 8 |
# File 'lib/pinnable/configuration.rb', line 6 def resolver_label @resolver_label end |
#tenant_scope ⇒ Object
Returns the value of attribute tenant_scope.
6 7 8 |
# File 'lib/pinnable/configuration.rb', line 6 def tenant_scope @tenant_scope end |
#user_label ⇒ Object
Returns the value of attribute user_label.
6 7 8 |
# File 'lib/pinnable/configuration.rb', line 6 def user_label @user_label end |