Method: Charisma::Characteristic#initialize

Defined in:
lib/charisma/characteristic.rb

#initialize(name, options, &blk) ⇒ Characteristic

Create a characteristic.

Typically this is done via Charisma::Characterization#has within a characterize do . . . end block.

Parameters:

  • name (Symbol)

    The name of the characteristic. The method with this name will be called on the characterized object to retrieve its raw value.

  • options (Hash)

    The options hash.

  • [Symbol] (Hash)

    a customizable set of options

  • [Class, (Hash)

    a customizable set of options

  • [Proc] (Hash)

    a customizable set of options

See Also:



31
32
33
34
35
36
# File 'lib/charisma/characteristic.rb', line 31

def initialize(name, options, &blk)
  @name = name
  @proc = blk if block_given?
  @accessor = options[:display_with]
  @measurement = options[:measures]
end