Class: Diggit::Join Abstract

Inherits:
Runnable show all
Defined in:
lib/dgit/plugins.rb

Overview

This class is abstract.

Subclass and override run and clean to implement a custom join class.

Base class for joins. Joins are applied on each source that has been:

  1. succesfully cloned,

  2. has been analyzed by the required analyses.

Required analyses are added with a call to Join.require_analyses. They can access addons through the addons attribute or with a method having the addon name.

Examples:

A sample join using an addon.

class JoinWithAddon < Diggit::Join
	require_addons "db"

	def run
		db.do_something
		puts @options
		puts @sources
		puts "Runned!"
	end

	def clean
		puts "Cleaned!"
	end
end

See Also:

Instance Attribute Summary collapse

Attributes inherited from Runnable

#addons

Attributes inherited from Plugin

#options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Runnable

#clean, require_addons, required_addons, #run

Methods inherited from Plugin

#name, name, #read_option

Constructor Details

#initialize(options) ⇒ Join

Returns a new instance of Join.



136
137
138
139
# File 'lib/dgit/plugins.rb', line 136

def initialize(options)
	super(options)
	@sources = []
end

Instance Attribute Details

#sourcesArray<Source>

Returns the sources to be joined.

Returns:

  • (Array<Source>)

    the sources to be joined.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/dgit/plugins.rb', line 133

class Join < Runnable
	attr_accessor :sources

	def initialize(options)
		super(options)
		@sources = []
	end

	# Add an analysis as a required analysis.
	#
	# @param names [Array<String>] the names of analyses to require.
	# 	They correspond to the name of their class with underscore case.
	# @return [void]
	def self.require_analyses(*names)
		@required_analyses = names
	end

	def self.required_analyses
		return [] if @required_analyses.nil?
		@required_analyses
	end
end

Class Method Details

.require_analyses(*names) ⇒ void

This method returns an undefined value.

Add an analysis as a required analysis.

Parameters:

  • names (Array<String>)

    the names of analyses to require. They correspond to the name of their class with underscore case.



146
147
148
# File 'lib/dgit/plugins.rb', line 146

def self.require_analyses(*names)
	@required_analyses = names
end

.required_analysesObject



150
151
152
153
# File 'lib/dgit/plugins.rb', line 150

def self.required_analyses
	return [] if @required_analyses.nil?
	@required_analyses
end