Module: Synthra::Traits

Defined in:
lib/synthra/personas.rb

Overview

Reusable traits for personas

Defined Under Namespace

Classes: Trait

Class Method Summary collapse

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

Parameters:

  • name (Symbol)

    trait name

Yields:

  • trait configuration



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

.registryObject



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