Module: Synthra::Traits
- Defined in:
- lib/synthra/personas.rb
Overview
Reusable traits for personas
Defined Under Namespace
Classes: Trait
Class Method Summary collapse
- .[](name) ⇒ Object
-
.define(name) { ... } ⇒ Object
Define a trait.
- .registry ⇒ Object
- .reset! ⇒ Object
Class Method Details
.[](name) ⇒ Object
342 343 344 |
# File 'lib/synthra/personas.rb', line 342 def [](name) registry[name] end |
.define(name) { ... } ⇒ Object
Define a trait
336 337 338 339 340 |
# File 'lib/synthra/personas.rb', line 336 def define(name, &block) trait = Trait.new(name) trait.instance_eval(&block) if block registry[name] = trait end |
.registry ⇒ Object
327 328 329 |
# File 'lib/synthra/personas.rb', line 327 def registry @registry ||= {} end |
.reset! ⇒ Object
346 347 348 |
# File 'lib/synthra/personas.rb', line 346 def reset! @registry = {} end |