Module: Eco::Language::Delegation::ConstDelegator::ClassMethods
- Defined in:
- lib/eco/language/delegation/const_delegator.rb
Instance Method Summary collapse
- #const_defined?(str, inherit = true, delegated: true) ⇒ Boolean
- #const_get(str) ⇒ Object
- #const_missing(str) ⇒ Object
- #constants(inherited = true, delegated: true) ⇒ Object
Instance Method Details
#const_defined?(str, inherit = true, delegated: true) ⇒ Boolean
24 25 26 27 28 29 |
# File 'lib/eco/language/delegation/const_delegator.rb', line 24 def const_defined?(str, inherit = true, delegated: true) return super(str, inherit) if super(str, inherit) || !delegated return true if delegated_class&.const_defined?(str, inherit) false end |
#const_get(str) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/eco/language/delegation/const_delegator.rb', line 31 def const_get(str) return super if const_defined?(str, delegated: false) return delegated_class.const_get(str) if delegated_class&.const_defined?(str) super end |
#const_missing(str) ⇒ Object
38 39 40 41 42 |
# File 'lib/eco/language/delegation/const_delegator.rb', line 38 def const_missing(str) return super unless const_defined?(str) const_get(str) end |
#constants(inherited = true, delegated: true) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/eco/language/delegation/const_delegator.rb', line 44 def constants(inherited = true, delegated: true) super(inherited).dup.tap do |consts| next unless delegated && delegated_class delegated_class.constants(inherited).each do |const| consts.unshift(const) end end end |