Sha256: 9864b0954078c20e845ee720f8b06b24874eb3c61f4b77ab1b733cb13d1afc66

Contents?: true

Size: 521 Bytes

Versions: 58

Compression:

Stored size: 521 Bytes

Contents

module Para
  module Component
    module Subclassable
      extend ActiveSupport::Concern

      included do
        configurable_on :subclasses
      end

      def subclassable?
        @subclassable ||= subclass_names.length > 0
      end

      def subclassable_with?(class_name)
        subclassable? && class_name.in?(subclass_names)
      end

      def subclass_names
        @subclass_names ||= if subclasses.present?
          eval(subclasses)
        else
          []
        end
      end
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
para-0.12.4 lib/para/component/subclassable.rb
para-0.12.3 lib/para/component/subclassable.rb
para-0.12.2 lib/para/component/subclassable.rb
para-0.12.1 lib/para/component/subclassable.rb
para-0.12.0 lib/para/component/subclassable.rb
para-0.11.4 lib/para/component/subclassable.rb
para-0.11.3 lib/para/component/subclassable.rb
para-0.11.2 lib/para/component/subclassable.rb
para-0.11.1 lib/para/component/subclassable.rb
para-0.11.0 lib/para/component/subclassable.rb
para-0.10.0 lib/para/component/subclassable.rb
para-0.9.4 lib/para/component/subclassable.rb
para-0.9.3.3 lib/para/component/subclassable.rb
para-0.9.3.2 lib/para/component/subclassable.rb
para-0.9.3.1 lib/para/component/subclassable.rb
para-0.9.2 lib/para/component/subclassable.rb
para-0.9.0 lib/para/component/subclassable.rb
para-0.8.15 lib/para/component/subclassable.rb
para-0.8.14 lib/para/component/subclassable.rb
para-0.8.13 lib/para/component/subclassable.rb