Module: Domain::SByC::Methods

Defined in:
lib/domain/factory/sbyc.rb

Instance Method Summary collapse

Instance Method Details

#===(value) ⇒ Object

Checks if ‘value` belongs to this domain



26
27
28
# File 'lib/domain/factory/sbyc.rb', line 26

def ===(value)
  superclass===value && predicate.call(value)
end

#new(first = nil, *args) ⇒ Object

Creates a new instance of this domain



19
20
21
22
23
# File 'lib/domain/factory/sbyc.rb', line 19

def new(first = nil, *args)
  return first if args.empty? && self===first
  return new super(first, *args) if superclass.respond_to?(:new) && (superclass != Object)
  domain_error!(first, *args)
end