Sha256: 5f5e2e2b28537b0fd6c188d6ed34d6aac4f058af70a2dc6c6e819a6715d56a0b

Contents?: true

Size: 588 Bytes

Versions: 1

Compression:

Stored size: 588 Bytes

Contents

# frozen_string_literal: true

module Lite
  module Component
    class Base < Lite::Component::Element

      class << self

        def component_name
          component_path.split('/').last
        end

        def component_path
          name.chomp('Component').underscore
        end

        def model_name
          ActiveModel::Name.new(Lite::Component::Base)
        end

      end

      def render
        @view.render(partial: to_partial_path, object: self)
      end

      def to_partial_path
        "components/#{self.class.component_path}"
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lite-component-1.0.0 lib/lite/component/base.rb