Method: ModelFact.try_register
- Defined in:
- lib/model_fact.rb
.try_register(id, cls, opts = { }) ⇒ Object
try_register will not throw exception if ID already registered
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/model_fact.rb', line 30 def self.try_register(id, cls, opts = { }) opts = { } if opts.nil? if Registry.instance.is_registered?(id) or (not_empty?(opts[:alias]) and Registry.instance.is_alias_registered?(opts[:alias])) false else register(id, cls, opts) true end end |