Class: RubyUIConverter::Configuration
- Inherits:
-
Object
- Object
- RubyUIConverter::Configuration
- Defined in:
- lib/ruby_ui_converter/configuration.rb
Instance Attribute Summary collapse
-
#base_class ⇒ Object
Returns the value of attribute base_class.
-
#base_namespace ⇒ Object
Returns the value of attribute base_namespace.
-
#component_map ⇒ Object
Returns the value of attribute component_map.
-
#dry_run ⇒ Object
Returns the value of attribute dry_run.
-
#force ⇒ Object
Returns the value of attribute force.
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#literal ⇒ Object
Returns the value of attribute literal.
-
#output_root ⇒ Object
Returns the value of attribute output_root.
-
#phlex_version ⇒ Object
Returns the value of attribute phlex_version.
-
#root ⇒ Object
Returns the value of attribute root.
-
#ruby_ui ⇒ Object
Returns the value of attribute ruby_ui.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #enable_rubyui_rules! ⇒ Object
-
#initialize(base_namespace: "Views", base_class: "Phlex::HTML", phlex_version: 2, indent: " ", output_root: nil, verbose: false, dry_run: false, force: false, ruby_ui: true, literal: false, root: nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #literal? ⇒ Boolean
-
#raw_call(expr) ⇒ Object
Emit a raw (unescaped) output call for the given Ruby expression.
- #ruby_ui? ⇒ Boolean
-
#template_method ⇒ Object
Phlex 2 uses ‘view_template`; Phlex 1 used `template`.
Constructor Details
#initialize(base_namespace: "Views", base_class: "Phlex::HTML", phlex_version: 2, indent: " ", output_root: nil, verbose: false, dry_run: false, force: false, ruby_ui: true, literal: false, root: nil) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ruby_ui_converter/configuration.rb', line 9 def initialize(base_namespace: "Views", base_class: "Phlex::HTML", phlex_version: 2, indent: " ", output_root: nil, verbose: false, dry_run: false, force: false, ruby_ui: true, literal: false, root: nil) @base_namespace = base_namespace @base_class = base_class @phlex_version = phlex_version @indent = indent @output_root = output_root @verbose = verbose @dry_run = dry_run @force = force @ruby_ui = ruby_ui @literal = literal @root = root @component_map = ComponentMap.new enable_rubyui_rules! if ruby_ui end |
Instance Attribute Details
#base_class ⇒ Object
Returns the value of attribute base_class.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def base_class @base_class end |
#base_namespace ⇒ Object
Returns the value of attribute base_namespace.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def base_namespace @base_namespace end |
#component_map ⇒ Object
Returns the value of attribute component_map.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def component_map @component_map end |
#dry_run ⇒ Object
Returns the value of attribute dry_run.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def dry_run @dry_run end |
#force ⇒ Object
Returns the value of attribute force.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def force @force end |
#indent ⇒ Object
Returns the value of attribute indent.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def indent @indent end |
#literal ⇒ Object
Returns the value of attribute literal.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def literal @literal end |
#output_root ⇒ Object
Returns the value of attribute output_root.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def output_root @output_root end |
#phlex_version ⇒ Object
Returns the value of attribute phlex_version.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def phlex_version @phlex_version end |
#root ⇒ Object
Returns the value of attribute root.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def root @root end |
#ruby_ui ⇒ Object
Returns the value of attribute ruby_ui.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def ruby_ui @ruby_ui end |
#verbose ⇒ Object
Returns the value of attribute verbose.
5 6 7 |
# File 'lib/ruby_ui_converter/configuration.rb', line 5 def verbose @verbose end |
Instance Method Details
#enable_rubyui_rules! ⇒ Object
48 49 50 51 |
# File 'lib/ruby_ui_converter/configuration.rb', line 48 def enable_rubyui_rules! ComponentMap.rubyui_rules(@component_map) self end |
#literal? ⇒ Boolean
44 45 46 |
# File 'lib/ruby_ui_converter/configuration.rb', line 44 def literal? !!@literal end |
#raw_call(expr) ⇒ Object
Emit a raw (unescaped) output call for the given Ruby expression. Phlex 2 dropped ‘unsafe_raw` in favor of `raw(safe(…))`; Phlex 1 used `unsafe_raw(…)`.
36 37 38 |
# File 'lib/ruby_ui_converter/configuration.rb', line 36 def raw_call(expr) phlex_version.to_i >= 2 ? "raw(safe(#{expr}))" : "unsafe_raw(#{expr})" end |
#ruby_ui? ⇒ Boolean
40 41 42 |
# File 'lib/ruby_ui_converter/configuration.rb', line 40 def ruby_ui? !!@ruby_ui end |
#template_method ⇒ Object
Phlex 2 uses ‘view_template`; Phlex 1 used `template`.
29 30 31 |
# File 'lib/ruby_ui_converter/configuration.rb', line 29 def template_method phlex_version.to_i >= 2 ? "view_template" : "template" end |