Module: Lucy
- Defined in:
- lib/lucy.rb,
lib/lucy/common.rb
Defined Under Namespace
Modules: Common
Classes: JavascriptGenerator
Constant Summary
collapse
- DEFAULT_NAMESPACE =
"Lucy"
- DEFAULT_GLOBAL =
"window"
Class Method Summary
collapse
Class Method Details
.file(src_path, dest_path = nil) ⇒ Object
22
23
24
|
# File 'lib/lucy.rb', line 22
def self.file(src_path, dest_path=nil)
File.cp(src_path, dest_path || javascript_dir)
end
|
.generate(key, content = nil, path = nil) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/lucy.rb', line 10
def self.generate(key, content=nil, path=nil)
File.open(path || File.join(javascript_dir, "#{key}.js"), "w") do |f|
g = JavascriptGenerator.new
if block_given?
yield g
else
g.write key, content
end
f.write g.to_js
end
end
|
.javascript_dir ⇒ Object
6
7
8
|
# File 'lib/lucy.rb', line 6
def self.javascript_dir
@js_dir ||= File.join(Rails.root, "public", "javascripts")
end
|