Class: Staticz::Sub
- Inherits:
-
Object
- Object
- Staticz::Sub
- Defined in:
- lib/manifest/sub.rb
Instance Attribute Summary collapse
-
#elements ⇒ Object
readonly
Returns the value of attribute elements.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #build ⇒ Object
- #coffee(name, &block) ⇒ Object
- #create_link_function ⇒ Object
- #haml(name, &block) ⇒ Object
-
#initialize(name) ⇒ Sub
constructor
A new instance of Sub.
- #js(name, &block) ⇒ Object
- #path ⇒ Object
- #print(indentation) ⇒ Object
- #sass(name, &block) ⇒ Object
- #scss(name, &block) ⇒ Object
- #sub(name, &block) ⇒ Object
Constructor Details
#initialize(name) ⇒ Sub
Returns a new instance of Sub.
5 6 7 8 |
# File 'lib/manifest/sub.rb', line 5 def initialize(name) @name = name @elements = [] end |
Instance Attribute Details
#elements ⇒ Object (readonly)
Returns the value of attribute elements.
3 4 5 |
# File 'lib/manifest/sub.rb', line 3 def elements @elements end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/manifest/sub.rb', line 3 def name @name end |
Instance Method Details
#build ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/manifest/sub.rb', line 36 def build Dir.mkdir("build/#{name}") if !Dir.exist?("build/#{name}") elements.each do |e| e.build end end |
#coffee(name, &block) ⇒ Object
32 33 34 |
# File 'lib/manifest/sub.rb', line 32 def coffee(name, &block) elements.push(Staticz::Cs.new("#{@name}/#{name}")) end |
#create_link_function ⇒ Object
44 45 46 47 48 |
# File 'lib/manifest/sub.rb', line 44 def create_link_function elements.each do |e| e.create_link_function end end |
#haml(name, &block) ⇒ Object
16 17 18 |
# File 'lib/manifest/sub.rb', line 16 def haml(name, &block) elements.push(Staticz::Haml.new("#{@name}/#{name}")) end |
#js(name, &block) ⇒ Object
28 29 30 |
# File 'lib/manifest/sub.rb', line 28 def js(name, &block) elements.push(Staticz::Js.new("#{@name}/#{name}")) end |
#path ⇒ Object
57 58 59 |
# File 'lib/manifest/sub.rb', line 57 def path "src/#{name}" end |
#print(indentation) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/manifest/sub.rb', line 50 def print(indentation) puts "#{" " * (indentation * 3)}└─ Sub: #{name}" elements.each do |e| e.print(indentation + 1) end end |
#sass(name, &block) ⇒ Object
20 21 22 |
# File 'lib/manifest/sub.rb', line 20 def sass(name, &block) elements.push(Staticz::Sass.new("#{@name}/#{name}")) end |