Class: Jazari::Configuration
- Inherits:
-
Struct
- Object
- Struct
- Jazari::Configuration
- Defined in:
- lib/jazari.rb
Instance Attribute Summary collapse
-
#actor_ref ⇒ Object
Returns the value of attribute actor_ref.
-
#anchor_scopes ⇒ Object
Returns the value of attribute anchor_scopes.
-
#on_subject_destroyed ⇒ Object
Returns the value of attribute on_subject_destroyed.
-
#table_names ⇒ Object
Returns the value of attribute table_names.
-
#table_prefix ⇒ Object
Returns the value of attribute table_prefix.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#validate! ⇒ Object
Fail at boot, not at first call.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/jazari.rb', line 38 def initialize(*) super self.anchor_scopes ||= {} self.table_prefix ||= "jazari_" # Per-table overrides. A prefix alone is not enough for a host adopting # tables it already has: existing names rarely follow one scheme, and # renaming live tables in the same deploy as a cut-over is exactly what # the adoption plan forbids. Any key omitted falls back to the prefix. self.table_names ||= {} # Optional zero-argument provider for trusted system contexts. User and # agent callers should pass an explicit opaque actor_ref. self.actor_ref = nil if actor_ref.nil? end |
Instance Attribute Details
#actor_ref ⇒ Object
Returns the value of attribute actor_ref
36 37 38 |
# File 'lib/jazari.rb', line 36 def actor_ref @actor_ref end |
#anchor_scopes ⇒ Object
Returns the value of attribute anchor_scopes
36 37 38 |
# File 'lib/jazari.rb', line 36 def anchor_scopes @anchor_scopes end |
#on_subject_destroyed ⇒ Object
Returns the value of attribute on_subject_destroyed
36 37 38 |
# File 'lib/jazari.rb', line 36 def on_subject_destroyed @on_subject_destroyed end |
#table_names ⇒ Object
Returns the value of attribute table_names
36 37 38 |
# File 'lib/jazari.rb', line 36 def table_names @table_names end |
#table_prefix ⇒ Object
Returns the value of attribute table_prefix
36 37 38 |
# File 'lib/jazari.rb', line 36 def table_prefix @table_prefix end |
Instance Method Details
#validate! ⇒ Object
Fail at boot, not at first call.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/jazari.rb', line 53 def validate! anchor_scopes.each_key do |scope| raise ArgumentError, "anchor scope #{scope.inspect} must be a String" unless scope.is_a?(String) end if actor_ref && !actor_ref.is_a?(String) && !(actor_ref.respond_to?(:call) && actor_ref.respond_to?(:arity) && actor_ref.arity.zero?) raise ArgumentError, "actor_ref must be a String or zero-argument callable" end true end |