Module: Ree::LinkDSL

Defined in:
lib/ree/link_dsl.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



9
10
11
12
# File 'lib/ree/link_dsl.rb', line 9

def self.extended(base)
  validate(base)
  base.extend(ClassMethods)
end

.included(base) ⇒ Object



4
5
6
7
# File 'lib/ree/link_dsl.rb', line 4

def self.included(base)
  validate(base)
  base.extend(ClassMethods)
end

.validate(base) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/ree/link_dsl.rb', line 14

def self.validate(base)
  if !base.is_a?(Class)
    raise ArgumentError, "Ree::LinkDSL should be included to named classed only"
  end

  if self.name.nil?
    raise ArgumentError, "LinkDSL does not support anonymous classes"
  end
end