Class: RailsProof::TargetDiscovery

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_proof/target_discovery.rb

Defined Under Namespace

Classes: Target

Constant Summary collapse

SUPPORTED_DIRECTORIES =
{
  "app/models" => :model,
  "app/controllers" => :controller
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root:, scope: nil) ⇒ TargetDiscovery

Returns a new instance of TargetDiscovery.



20
21
22
23
# File 'lib/rails_proof/target_discovery.rb', line 20

def initialize(root:, scope: nil)
  @root = Pathname.new(root)
  @scope = scope
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



18
19
20
# File 'lib/rails_proof/target_discovery.rb', line 18

def root
  @root
end

#scopeObject (readonly)

Returns the value of attribute scope.



18
19
20
# File 'lib/rails_proof/target_discovery.rb', line 18

def scope
  @scope
end

Instance Method Details

#targetsObject



25
26
27
28
29
30
31
# File 'lib/rails_proof/target_discovery.rb', line 25

def targets
  @targets ||= if normalized_scope
    discover_scope(normalized_scope)
  else
    discover_all
  end
end