Sha256: 8fee75b502112462224d16c662aecac645a8092b7bf798c09db962c5895e4e2f

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 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
        context.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.1 lib/lite/component/base.rb