Module: RubyFeatures::Utils::ConstAccessor19

Defined in:
lib/ruby-features/utils/const_accessor_19.rb

Instance Method Summary collapse

Instance Method Details

#ruby_const_defined?(target, const_name) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
# File 'lib/ruby-features/utils/const_accessor_19.rb', line 4

def ruby_const_defined?(target, const_name)
  !!inject_const_parts_with_target(target, const_name){ |parent, submodule|
    parent && parent.const_defined?(submodule) ?
      parent.const_get(submodule) :
      false
  }
end

#ruby_const_get(target, const_name) ⇒ Object



12
13
14
15
16
# File 'lib/ruby-features/utils/const_accessor_19.rb', line 12

def ruby_const_get(target, const_name)
  inject_const_parts_with_target(target, const_name) do |parent, submodule|
    parent.const_get(submodule)
  end
end