Class: Bunch::CoffeeNode
Class Attribute Summary collapse
Attributes inherited from AbstractNode
#options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from FileNode
#inspect
#write_to_dir, #write_to_file
Constructor Details
Returns a new instance of CoffeeNode.
Class Attribute Details
.bare ⇒ Object
35
36
37
|
# File 'lib/bunch/coffee_node.rb', line 35
def bare
defined?(@bare) ? @bare : (@bare = false)
end
|
Class Method Details
.require_coffee ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/bunch/coffee_node.rb', line 26
def require_coffee
unless @required
require 'coffee-script'
@required = true
end
rescue LoadError
raise "'gem install coffee-script' to compile .coffee files."
end
|
Instance Method Details
#content ⇒ Object
8
9
10
11
12
|
# File 'lib/bunch/coffee_node.rb', line 8
def content
@content ||= fetch(@filename) { CoffeeScript.compile(File.read(@filename), :bare => CoffeeNode.bare) }
rescue => e
raise CompileError.new(e, @filename)
end
|
#name ⇒ Object
14
15
16
|
# File 'lib/bunch/coffee_node.rb', line 14
def name
File.basename(@filename, '.coffee')
end
|
#target_extension ⇒ Object
18
19
20
|
# File 'lib/bunch/coffee_node.rb', line 18
def target_extension
'.js'
end
|