Sha256: d39d30100f582ebbf63901751421250d2341636518ee23e61ad3d2f5dc8ef5bf

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

require_relative 'index_definition/presenter'
require_relative 'edit_definition/presenter'
require_relative 'new_definition/presenter'
require_relative 'show_definition/presenter'
require_relative 'form_definition/presenter'

module WebammToRails
  module Sources
    module Views
      module Resource
        class Presenter
          def initialize(crud_definition:, waml_definition:)
            @crud_definition = crud_definition
            @waml_definition = waml_definition
          end

          def collection
            views.select(&:render?).map do |view|
              {
                path: view.path_name,
                content: view.render
              }
            end
          end

          private

          def views
            [
              ::WebammToRails::Sources::Views::Resource::IndexDefinition::Presenter.new(crud_definition: @crud_definition),
              ::WebammToRails::Sources::Views::Resource::EditDefinition::Presenter.new(crud_definition: @crud_definition),
              ::WebammToRails::Sources::Views::Resource::NewDefinition::Presenter.new(crud_definition: @crud_definition),
              ::WebammToRails::Sources::Views::Resource::ShowDefinition::Presenter.new(crud_definition: @crud_definition),
              ::WebammToRails::Sources::Views::Resource::FormDefinition::Presenter.new(crud_definition: @crud_definition, waml_definition: @waml_definition),
            ]
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webamm_to_rails-7.0.1 lib/webamm_to_rails/sources/views/resource/presenter.rb
webamm_to_rails-7.0.0 lib/webamm_to_rails/sources/views/resource/presenter.rb