Class: Rake::Minify::Group
- Inherits:
-
Object
- Object
- Rake::Minify::Group
- Defined in:
- lib/rake/minify/group.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #add(*args, &block) ⇒ Object
- #build ⇒ Object
- #dir(dir, &block) ⇒ Object
-
#initialize(parent, &block) ⇒ Group
constructor
A new instance of Group.
Constructor Details
#initialize(parent, &block) ⇒ Group
Returns a new instance of Group.
6 7 8 9 10 11 |
# File 'lib/rake/minify/group.rb', line 6 def initialize(parent, &block) @sources = [] @parent = parent instance_eval &block if block end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
4 5 6 |
# File 'lib/rake/minify/group.rb', line 4 def parent @parent end |
Instance Method Details
#add(*args, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rake/minify/group.rb', line 13 def add(*args, &block) if block source = block else source = parent.build_path(args.shift) end opts = args.shift opts ||= { :minify => true } @sources << Source.new(source, opts) end |
#build ⇒ Object
26 27 28 |
# File 'lib/rake/minify/group.rb', line 26 def build @sources.map { |s| s.build }.join("\n") end |
#dir(dir, &block) ⇒ Object
30 31 32 |
# File 'lib/rake/minify/group.rb', line 30 def dir(dir, &block) parent.dir(dir, &block) end |