Module: Qpid::Proton::Util::Constants::ClassMethods

Defined in:
lib/util/constants.rb

Instance Method Summary collapse

Instance Method Details

#add_constant(key, value) ⇒ Object



66
67
68
69
70
71
72
73
74
75
# File 'lib/util/constants.rb', line 66

def add_constant(key, value)
  self.const_set(key, value)

  @pn_by_value ||= {}
  @pn_by_value[value] = key

  if self.respond_to? :post_add_constant
    self.post_add_constant(key, value)
  end
end

#by_value(value) ⇒ Object



77
78
79
# File 'lib/util/constants.rb', line 77

def by_value(value)
  (@pn_by_value || {})[value]
end