Module: OkHbase

Defined in:
lib/ok_hbase.rb,
lib/ok_hbase/row.rb,
lib/ok_hbase/table.rb,
lib/ok_hbase/client.rb,
lib/ok_hbase/version.rb,
lib/ok_hbase/concerns.rb,
lib/ok_hbase/connection.rb,
lib/ok_hbase/active_model.rb,
lib/ok_hbase/concerns/row.rb,
lib/ok_hbase/concerns/table.rb,
lib/ok_hbase/concerns/indexable.rb,
lib/ok_hbase/concerns/custom_row.rb,
lib/ok_hbase/concerns/table/batch.rb,
lib/ok_hbase/concerns/table/class_methods.rb,
lib/ok_hbase/concerns/table/instrumentation.rb,
lib/ok_hbase/concerns/indexable/class_methods.rb,
lib/ok_hbase/concerns/custom_row/class_methods.rb

Defined Under Namespace

Modules: Concerns Classes: ActiveModel, Client, Connection, Row, Table

Constant Summary collapse

VERSION =
"0.0.5"

Class Method Summary collapse

Class Method Details

.increment_string(string) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/ok_hbase.rb', line 20

def self.increment_string(string)
  bytes = string.bytes.to_a
  (0...bytes.length).to_a.reverse.each do |i|
    return (bytes[0...i] << bytes[i]+1).pack('C*').force_encoding(Encoding::UTF_8) unless bytes[i] == 255
  end
  nil
end

.init_loggerObject



16
17
18
# File 'lib/ok_hbase.rb', line 16

def self.init_logger
  Logger.new("/dev/null")
end

.loggerObject



12
13
14
# File 'lib/ok_hbase.rb', line 12

def self.logger
  @@logger ||= init_logger
end

.rootObject



8
9
10
# File 'lib/ok_hbase.rb', line 8

def self.root
  ::Pathname.new File.expand_path('../../', __FILE__)
end

.thrift_type_to_dict(obj) ⇒ Object



28
29
30
# File 'lib/ok_hbase.rb', line 28

def self.thrift_type_to_dict(obj)
  Hash[obj.class::FIELDS.map{ |k, v| [v[:name].underscore, obj.send(v[:name])]}]
end