Class: WebammToRails::Sources::Controllers::Actions::EditDefinition::Presenter
- Inherits:
-
Object
- Object
- WebammToRails::Sources::Controllers::Actions::EditDefinition::Presenter
- Defined in:
- lib/webamm_to_rails/sources/controllers/actions/edit_definition/presenter.rb
Instance Method Summary collapse
- #access_scope ⇒ Object
-
#initialize(table_name:, crud_definition:) ⇒ Presenter
constructor
A new instance of Presenter.
- #render ⇒ Object
- #render? ⇒ Boolean
Constructor Details
#initialize(table_name:, crud_definition:) ⇒ Presenter
Returns a new instance of Presenter.
7 8 9 10 |
# File 'lib/webamm_to_rails/sources/controllers/actions/edit_definition/presenter.rb', line 7 def initialize(table_name:, crud_definition:) @table_name = table_name @crud_definition = crud_definition end |
Instance Method Details
#access_scope ⇒ Object
20 |
# File 'lib/webamm_to_rails/sources/controllers/actions/edit_definition/presenter.rb', line 20 def access_scope = :public |
#render ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/webamm_to_rails/sources/controllers/actions/edit_definition/presenter.rb', line 12 def render template_path = File.('template.erb', __dir__) template_content = File.read(template_path) raw_content = ERB.new(template_content, trim_mode: '-').result(instance_eval { binding }) ::WebammToRails::Utils::FormatCode.call(raw_content) end |
#render? ⇒ Boolean
22 23 24 |
# File 'lib/webamm_to_rails/sources/controllers/actions/edit_definition/presenter.rb', line 22 def render? @crud_definition.actions.find { |action| action.name == 'update' }.present? end |