Class: JsGenerator::ViewFile
- Inherits:
-
Object
- Object
- JsGenerator::ViewFile
- Defined in:
- lib/js_generator/view_file.rb
Instance Attribute Summary collapse
-
#action_name ⇒ Object
readonly
Returns the value of attribute action_name.
-
#model_name ⇒ Object
readonly
Returns the value of attribute model_name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#syntax_builder ⇒ Object
readonly
Returns the value of attribute syntax_builder.
Instance Method Summary collapse
- #append_script_tag ⇒ Object
-
#initialize(setup_js, syntax_builder) ⇒ ViewFile
constructor
A new instance of ViewFile.
Constructor Details
#initialize(setup_js, syntax_builder) ⇒ ViewFile
Returns a new instance of ViewFile.
5 6 7 8 9 10 |
# File 'lib/js_generator/view_file.rb', line 5 def initialize(setup_js, syntax_builder) @namespace = setup_js.namespace @model_name = setup_js.model_name @action_name = setup_js.action_name @syntax_builder = syntax_builder end |
Instance Attribute Details
#action_name ⇒ Object (readonly)
Returns the value of attribute action_name.
3 4 5 |
# File 'lib/js_generator/view_file.rb', line 3 def action_name @action_name end |
#model_name ⇒ Object (readonly)
Returns the value of attribute model_name.
3 4 5 |
# File 'lib/js_generator/view_file.rb', line 3 def model_name @model_name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
3 4 5 |
# File 'lib/js_generator/view_file.rb', line 3 def namespace @namespace end |
#syntax_builder ⇒ Object (readonly)
Returns the value of attribute syntax_builder.
3 4 5 |
# File 'lib/js_generator/view_file.rb', line 3 def syntax_builder @syntax_builder end |
Instance Method Details
#append_script_tag ⇒ Object
12 13 14 15 16 |
# File 'lib/js_generator/view_file.rb', line 12 def append_script_tag File.open(file_path, 'a') { |f| f << script_tag } puts "📝 Appended <script> tag to #{file_path}" end |