Class: JsGenerator::SetupJs
- Inherits:
-
Object
- Object
- JsGenerator::SetupJs
- Defined in:
- lib/js_generator.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.
-
#top_level_js_namespace ⇒ Object
Returns the value of attribute top_level_js_namespace.
Instance Method Summary collapse
-
#initialize(namespace: nil, model_name:, action_name:) ⇒ SetupJs
constructor
A new instance of SetupJs.
- #run ⇒ Object
Constructor Details
#initialize(namespace: nil, model_name:, action_name:) ⇒ SetupJs
Returns a new instance of SetupJs.
16 17 18 19 20 21 |
# File 'lib/js_generator.rb', line 16 def initialize(namespace: nil, model_name:, action_name:) @namespace = namespace @model_name = model_name @action_name = action_name @top_level_js_namespace = ENV['TOP_LEVEL_JS_NAMESPACE'] end |
Instance Attribute Details
#action_name ⇒ Object (readonly)
Returns the value of attribute action_name.
13 14 15 |
# File 'lib/js_generator.rb', line 13 def action_name @action_name end |
#model_name ⇒ Object (readonly)
Returns the value of attribute model_name.
13 14 15 |
# File 'lib/js_generator.rb', line 13 def model_name @model_name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
13 14 15 |
# File 'lib/js_generator.rb', line 13 def namespace @namespace end |
#top_level_js_namespace ⇒ Object
Returns the value of attribute top_level_js_namespace.
14 15 16 |
# File 'lib/js_generator.rb', line 14 def top_level_js_namespace @top_level_js_namespace end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/js_generator.rb', line 23 def run if top_level_js_namespace.nil? raise Error.new('Please set TOP_LEVEL_JS_NAMESPACE in .env') end create_file append_script append_script_tag puts "✨ All done!" end |