Class: JsDefer
- Inherits:
-
Object
- Object
- JsDefer
- Defined in:
- lib/jsdefer.rb
Constant Summary collapse
- @@instance =
JsDefer.new
Class Method Summary collapse
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize ⇒ JsDefer
constructor
A new instance of JsDefer.
- #push_file(file) ⇒ Object
- #push_script(script) ⇒ Object
Constructor Details
#initialize ⇒ JsDefer
Returns a new instance of JsDefer.
3 4 5 6 |
# File 'lib/jsdefer.rb', line 3 def initialize @file_list = [] @script_list = [] end |
Class Method Details
.instance ⇒ Object
36 37 38 |
# File 'lib/jsdefer.rb', line 36 def self.instance @@instance end |
Instance Method Details
#flush ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/jsdefer.rb', line 16 def flush ret = "" @file_list.each do |file| puts "[#{file}]" ret += "#{file}\n" end @script_list.each do |script| puts "[#{script}]" ret += "#{script}\n" end @file_list.clear @script_list.clear ret end |
#push_file(file) ⇒ Object
8 9 10 |
# File 'lib/jsdefer.rb', line 8 def push_file(file) @file_list << file end |
#push_script(script) ⇒ Object
12 13 14 |
# File 'lib/jsdefer.rb', line 12 def push_script(script) @script_list << script end |