Class: Module

Inherits:
Object show all
Defined in:
lib/card/core_ext.rb

Constant Summary collapse

RUBY_VERSION_18 =
!!(RUBY_VERSION =~ /^1\.8/)

Instance Method Summary collapse

Instance Method Details

#const_get_if_defined(const) ⇒ Object



46
47
48
49
50
51
# File 'lib/card/core_ext.rb', line 46

def const_get_if_defined const
  args = RUBY_VERSION_18 ? [ const ] : [ const, false ]
  if const_defined? *args
    const_get *args
  end
end

#const_get_or_set(const) ⇒ Object



53
54
55
# File 'lib/card/core_ext.rb', line 53

def const_get_or_set const
  const_get_if_defined const or const_set const, yield
end