Class: Take::Project::Target
- Inherits:
-
Object
- Object
- Take::Project::Target
- Defined in:
- lib/take/project/target.rb
Instance Method Summary collapse
-
#initialize(hash, project, &block) ⇒ Target
constructor
Initializes the target.
- #invalid? ⇒ Boolean
- #name ⇒ Object
- #sub(what, to) ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(hash, project, &block) ⇒ Target
Initializes the target.
23 24 25 26 27 28 29 30 31 |
# File 'lib/take/project/target.rb', line 23 def initialize(hash, project, &block) raise ArgumentError, "Targets require blocks" \ unless block_given? @block = block @project = project @dependencies = [] handle_arguments(hash) guess_type unless @type end |
Instance Method Details
#invalid? ⇒ Boolean
33 34 35 |
# File 'lib/take/project/target.rb', line 33 def invalid? @target.is_a?(Symbol) end |
#name ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/take/project/target.rb', line 37 def name if invalid? @target else @target.to_path end end |
#sub(what, to) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/take/project/target.rb', line 45 def sub(what, to) @dependencies.map do |dep| if dep.extname == what dep.sub_ext(to) else dep end end end |
#to_a ⇒ Object
55 56 57 |
# File 'lib/take/project/target.rb', line 55 def to_a @dependencies.map(&:to_path) end |