module Cequel::Util::HashAccessors

@api private

Public Instance Methods

hattr_accessor(hash, *attributes) click to toggle source
# File lib/cequel/util.rb, line 42
def hattr_accessor(hash, *attributes)
  hattr_reader(hash, *attributes)
  hattr_writer(hash, *attributes)
end
hattr_inquirer(hash, *attributes) click to toggle source
# File lib/cequel/util.rb, line 22
      def hattr_inquirer(hash, *attributes)
        attributes.each do |attribute|
          module_eval <<-RUBY, __FILE__, __LINE__ + 1
            def #{attribute}?
              !!#{hash}[#{attribute.to_sym.inspect}]
            end
          RUBY
        end
      end
hattr_reader(hash, *attributes) click to toggle source
# File lib/cequel/util.rb, line 12
      def hattr_reader(hash, *attributes)
        attributes.each do |attribute|
          module_eval <<-RUBY, __FILE__, __LINE__ + 1
            def #{attribute}
              #{hash}[#{attribute.to_sym.inspect}]
            end
          RUBY
        end
      end
hattr_writer(hash, *attributes) click to toggle source
# File lib/cequel/util.rb, line 32
      def hattr_writer(hash, *attributes)
        attributes.each do |attribute|
          module_eval <<-RUBY, __FILE__, __LINE__ + 1
            def #{attribute}=(value)
              #{hash}[#{attribute.to_sym.inspect}] = value
            end
          RUBY
        end
      end