Module: ClassX::AttributeMethods::ClassMethods

Defined in:
lib/classx/attribute.rb

Overview

:nodoc:

Defined Under Namespace

Modules: CoerceNothing, CoerceWithArray, CoerceWithHash, CoerceWithProc, DefaultWithNoProc, DefaultWithProc, TriggerArrayProc, ValidateEach, ValidateKindOf, ValidateNothing, ValidateRespondTo, ValidateWithNotProc, ValidateWithProc

Instance Method Summary collapse

Instance Method Details

#descObject

description for attribute



9
10
11
# File 'lib/classx/attribute.rb', line 9

def desc
  config[:desc]
end

#inspectObject



23
24
25
# File 'lib/classx/attribute.rb', line 23

def inspect
  "ClassX::Attribute[#{self.config.inspect}]"
end

#lazy?Boolean

when it lazy option specified, it will not be initialized when #initialize.

Returns:

  • (Boolean)


19
20
21
# File 'lib/classx/attribute.rb', line 19

def lazy?
  return config[:lazy]
end

#optional?Boolean

when this option specify true, not raise error in #initialize without value.

Returns:

  • (Boolean)


14
15
16
# File 'lib/classx/attribute.rb', line 14

def optional?
  return config[:optional]
end

#value_classObject



4
5
6
# File 'lib/classx/attribute.rb', line 4

def value_class
  config[:isa] || config[:kind_of]
end