Module: Such

Defined in:
lib/such/convention.rb,
lib/such.rb,
lib/such/part.rb,
lib/such/such.rb,
lib/such/parts.rb,
lib/such/thing.rb,
lib/such/things.rb

Overview

Use this to validate your configuration against the given convention. It should be run as part of your tests, not necessarily in your application.

Defined Under Namespace

Modules: Convention, Part, Parts, Thing, Things

Constant Summary collapse

VERSION =
'2.1.230106'

Class Method Summary collapse

Class Method Details

.subclass(name, super_class, **including, &block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/such/such.rb', line 2

def self.subclass(name, super_class, **including, &block)
  # See documentation for Class#new
  sub_class = const_set(name, Class.new(super_class))
  # To be able to say like:
  #   include Such::Thing
  #   attr_accessor :attribute2, :attribute2
  including.each{|these, mods| sub_class.public_send(these, *mods)}
  # And to explicitly define methods in the subclass:
  sub_class.class_eval(&block) if block
  return sub_class
end