Class: Module
- Defined in:
- lib/y_support/unicode.rb,
lib/y_support/core_ext/module/misc.rb,
lib/y_support/typing/module/typing.rb
Overview
Defined aliases:
-
★ – alias for include
-
ç for
class
in several method names
Instance Method Summary collapse
-
#compliance ⇒ Object
Compliance (declared compliance + ancestors).
-
#complies?(other_module) ⇒ Boolean
Compliance inquirer (declared compliance + ancestors).
-
#const_reset!(const, value) ⇒ Object
Redefines a constant without warning.
-
#const_set_if_not_defined(const, value) ⇒ Object
Sets a constant to a value if this has not been previously defined.
-
#declare_compliance!(other_module) ⇒ Object
Declaration of module / class compliance.
-
#declared_compliance ⇒ Object
Declared compliance getter.
-
#declares_compliance?(other_module) ⇒ Boolean
Declared complience inquirer.
Instance Method Details
#compliance ⇒ Object
Compliance (declared compliance + ancestors).
22 23 24 |
# File 'lib/y_support/typing/module/typing.rb', line 22 def compliance ( declared_compliance + ancestors ).uniq end |
#complies?(other_module) ⇒ Boolean
Compliance inquirer (declared compliance + ancestors).
8 9 10 11 |
# File 'lib/y_support/typing/module/typing.rb', line 8 def complies?( other_module ) other_module.aT_kind_of Module, "other module" compliance.include? other_module end |
#const_reset!(const, value) ⇒ Object
Redefines a constant without warning.
12 13 14 15 |
# File 'lib/y_support/core_ext/module/misc.rb', line 12 def const_reset!( const, value ) send :remove_const, const if const_defined? const const_set( const, value ) end |
#const_set_if_not_defined(const, value) ⇒ Object
Sets a constant to a value if this has not been previously defined.
6 7 8 |
# File 'lib/y_support/core_ext/module/misc.rb', line 6 def const_set_if_not_defined( const, value ) const_set( const, value ) unless const_defined? const end |
#declare_compliance!(other_module) ⇒ Object
Declaration of module / class compliance.
36 37 38 39 40 41 |
# File 'lib/y_support/typing/module/typing.rb', line 36 def declare_compliance! other_module other_module.aT_kind_of Module, "other module" return false if declared_compliance.include? other_module ( @declared_compliance ||= [] ) << other_module return true end |
#declared_compliance ⇒ Object
Declared compliance getter.
28 29 30 31 32 |
# File 'lib/y_support/typing/module/typing.rb', line 28 def declared_compliance ( ( @declared_compliance || [] ) + ancestors.map { |a| a.instance_variable_get( :@declared_compliance ) || [] }.reduce( [], :+ ) ).uniq end |
#declares_compliance?(other_module) ⇒ Boolean
Declared complience inquirer.
15 16 17 18 |
# File 'lib/y_support/typing/module/typing.rb', line 15 def declares_compliance?( other_module ) other_module.aT_kind_of Module, "other module" declared_compliance.include? other_module end |