Class: RVGP::Base::Command::PlotTarget

Inherits:
Target
  • Object
show all
Defined in:
lib/rvgp/base/command.rb

Overview

This is an implementation of Target, that matches Plots.

This class allows any of the current project’s plots, to match a target, based on their name and variants.

Any class that operates by way of a plot-defined target, can use this implementation, in lieu of re-implementing the wheel.

Instance Attribute Summary collapse

Attributes inherited from Target

#name, #status_name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Target

from_s, #matches?

Constructor Details

#initialize(name, plot) ⇒ PlotTarget

Create a new PlotTarget

Parameters:

  • name (String)

    A plot variant

  • plot (RVGP::Plot)

    A plot instance which will handle this variant



140
141
142
143
# File 'lib/rvgp/base/command.rb', line 140

def initialize(name, plot)
  super name, name
  @plot = plot
end

Instance Attribute Details

#plotRVGP::Plot (readonly)

An instance of the plot that offers our :name variant

Returns:



134
135
136
# File 'lib/rvgp/base/command.rb', line 134

def plot
  @plot
end

Class Method Details

.allArray<RVGP::Base::Command::PlotTarget>

All possible Plot Targets that the project has defined.

Returns:



160
161
162
163
164
# File 'lib/rvgp/base/command.rb', line 160

def self.all
  RVGP::Plot.all(RVGP.app.config.project_path('app/plots')).map do |plot|
    plot.variants.map { |params| new params[:name], plot }
  end.flatten
end