Class: Rigor::Plugin::EffectEntryPoints
- Inherits:
-
Object
- Object
- Rigor::Plugin::EffectEntryPoints
- Defined in:
- lib/rigor/plugin/effect_entry_points.rb
Overview
One entry of a plugin's effect_entry_points: — a named set of globs that
effects.snapshot.reach: may adopt by name (ADR-103 WD14).
reach: is "whose transitive footprint does the snapshot record", and the honest answer for a Rails
app — controller actions, perform, mailer methods, channel methods — is a fact about the framework
rather than about the project. So the framework's plugin names it and the project adopts it:
effects:
snapshot:
reach: [rails]
A preset is a glob set, matched against the project-relative file a method is defined in, with
the rigor unused --entry-point semantics Effects::EntryPoints already implements. Globs
rather than a class-ancestry filter, deliberately: reach: is resolved from the snapshot's own
method table, which carries a defining path per key and no ancestry — and a Rails app's layout IS
the ancestry, which is why the convention exists at all.
Instance Attribute Summary collapse
-
#globs ⇒ Object
readonly
Returns the value of attribute globs.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#why ⇒ Object
readonly
Returns the value of attribute why.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, globs:, why: "") ⇒ EffectEntryPoints
constructor
A new instance of EffectEntryPoints.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, globs:, why: "") ⇒ EffectEntryPoints
Returns a new instance of EffectEntryPoints.
28 29 30 31 32 33 34 35 |
# File 'lib/rigor/plugin/effect_entry_points.rb', line 28 def initialize(name:, globs:, why: "") @name = name.to_s.dup.freeze @globs = Array(globs).map { |glob| glob.to_s.dup.freeze }.uniq.sort.freeze raise ArgumentError, "effect entry-point preset #{@name.inspect} declares no globs" if @globs.empty? @why = why.to_s.dup.freeze freeze end |
Instance Attribute Details
#globs ⇒ Object (readonly)
Returns the value of attribute globs.
22 23 24 |
# File 'lib/rigor/plugin/effect_entry_points.rb', line 22 def globs @globs end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/rigor/plugin/effect_entry_points.rb', line 22 def name @name end |
#why ⇒ Object (readonly)
Returns the value of attribute why.
22 23 24 |
# File 'lib/rigor/plugin/effect_entry_points.rb', line 22 def why @why end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
41 42 43 |
# File 'lib/rigor/plugin/effect_entry_points.rb', line 41 def ==(other) other.is_a?(EffectEntryPoints) && to_h == other.to_h end |
#hash ⇒ Object
46 47 48 |
# File 'lib/rigor/plugin/effect_entry_points.rb', line 46 def hash to_h.hash end |
#to_h ⇒ Object
37 38 39 |
# File 'lib/rigor/plugin/effect_entry_points.rb', line 37 def to_h { "name" => @name, "globs" => @globs } end |