Class: JsFixtures::HTML
Direct Known Subclasses
Class Attribute Summary collapse
-
.local_fixture_path ⇒ Object
Returns the value of attribute local_fixture_path.
-
.template ⇒ Object
Returns the value of attribute template.
-
.type ⇒ Object
readonly
Returns the value of attribute type.
Instance Attribute Summary collapse
-
#post_scripts ⇒ Object
Returns the value of attribute post_scripts.
-
#pre_scripts ⇒ Object
Returns the value of attribute pre_scripts.
-
#scripts ⇒ Object
Returns the value of attribute scripts.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #clone(new_name) ⇒ Object
- #generate ⇒ Object
-
#initialize(name, config) ⇒ HTML
constructor
A new instance of HTML.
Methods inherited from Base
config, create, generate_all, get
Constructor Details
#initialize(name, config) ⇒ HTML
Returns a new instance of HTML.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/js_fixtures/html.rb', line 28 def initialize(name, config) @name = name @scripts = config[:scripts] ||= [] @pre_scripts = config[:settings] ||= "" @post_scripts = config[:post_scripts] ||= "" self.class.local_fixture_path ||= Dir.mktmpdir @location = "#{self.class.local_fixture_path}/#{@name}.html" @local_file = File.(@location) end |
Class Attribute Details
.local_fixture_path ⇒ Object
Returns the value of attribute local_fixture_path.
10 11 12 |
# File 'lib/js_fixtures/html.rb', line 10 def local_fixture_path @local_fixture_path end |
.template ⇒ Object
Returns the value of attribute template.
11 12 13 |
# File 'lib/js_fixtures/html.rb', line 11 def template @template end |
.type ⇒ Object (readonly)
Returns the value of attribute type.
11 12 13 |
# File 'lib/js_fixtures/html.rb', line 11 def type @type end |
Instance Attribute Details
#post_scripts ⇒ Object
Returns the value of attribute post_scripts.
26 27 28 |
# File 'lib/js_fixtures/html.rb', line 26 def post_scripts @post_scripts end |
#pre_scripts ⇒ Object
Returns the value of attribute pre_scripts.
26 27 28 |
# File 'lib/js_fixtures/html.rb', line 26 def pre_scripts @pre_scripts end |
#scripts ⇒ Object
Returns the value of attribute scripts.
26 27 28 |
# File 'lib/js_fixtures/html.rb', line 26 def scripts @scripts end |
Class Method Details
.inherited(subclass) ⇒ Object
17 18 19 |
# File 'lib/js_fixtures/html.rb', line 17 def inherited(subclass) super end |
Instance Method Details
#clone(new_name) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/js_fixtures/html.rb', line 46 def clone(new_name) self.class.new(new_name, :scripts => @scripts.dup, :settings => @pre_scripts.dup, :post_scripts => @post_scripts.dup) end |
#generate ⇒ Object
39 40 41 42 43 |
# File 'lib/js_fixtures/html.rb', line 39 def generate file = File.open(@local_file, 'w') file.syswrite(render_template()) file.close end |