Module: Cequel::Util::HashAccessors Private

Included in:
Record::RecordSet
Defined in:
lib/cequel/util.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#hattr_accessor(hash, *attributes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



43
44
45
46
# File 'lib/cequel/util.rb', line 43

def hattr_accessor(hash, *attributes)
  hattr_reader(hash, *attributes)
  hattr_writer(hash, *attributes)
end

#hattr_inquirer(hash, *attributes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
27
28
29
30
31
# File 'lib/cequel/util.rb', line 23

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) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
18
19
20
21
# File 'lib/cequel/util.rb', line 13

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) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
36
37
38
39
40
41
# File 'lib/cequel/util.rb', line 33

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