Sha256: aceb62c78cc726ce7399ca4a35ae2fdae4bc1cf3818d54cd8f7813625fe28e4e

Contents?: true

Size: 720 Bytes

Versions: 2

Compression:

Stored size: 720 Bytes

Contents

module WebammToRails
  module Sources
    module Initializers
      module DeviseDefinition
        class Presenter
          def initialize(waml_definition:)
            @waml_definition = waml_definition
          end

          def render
            template_path = File.expand_path('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

          private

          def features
            @waml_definition.authentication.map(&:features).flatten.uniq
          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/initializers/devise_definition/presenter.rb
webamm_to_rails-7.0.0 lib/webamm_to_rails/sources/initializers/devise_definition/presenter.rb