Module: Para::Component::Subclassable

Extended by:
ActiveSupport::Concern
Included in:
Crud
Defined in:
lib/para/component/subclassable.rb

Instance Method Summary collapse

Instance Method Details

#subclass_namesObject



18
19
20
21
22
23
24
# File 'lib/para/component/subclassable.rb', line 18

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

#subclassable?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/para/component/subclassable.rb', line 10

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

#subclassable_with?(class_name) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/para/component/subclassable.rb', line 14

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