Class: Sukima::Constraints

Inherits:
Object
  • Object
show all
Defined in:
lib/sukima/constraints.rb

Defined Under Namespace

Classes: Format, In, Length, Nonnil, Type

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.registrationsObject (readonly)

Returns the value of attribute registrations.



8
9
10
# File 'lib/sukima/constraints.rb', line 8

def registrations
  @registrations
end

Class Method Details

.const_added(const_name) ⇒ Object



10
11
12
13
14
15
# File 'lib/sukima/constraints.rb', line 10

def const_added(const_name)
  constrant_name = const_name.to_s
  constrant_name.gsub!(/(?<=[[:lower:]])(?=[[:upper:]])/, '_')
  constrant_name.downcase!
  @registrations[constrant_name.to_sym] = const_get(const_name).new
end