Class: HbaseAdapter::ColumnFamily
- Inherits:
-
Object
- Object
- HbaseAdapter::ColumnFamily
- Defined in:
- lib/hbase_adapter/column_family.rb
Constant Summary collapse
- KEY_MAP =
{ :name => :name, :max_versions => :maxVersions }
Instance Attribute Summary collapse
-
#column_descriptor ⇒ Object
readonly
Returns the value of attribute column_descriptor.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ ColumnFamily
constructor
A new instance of ColumnFamily.
- #max_versions ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ ColumnFamily
Returns a new instance of ColumnFamily.
15 16 17 18 19 20 21 22 |
# File 'lib/hbase_adapter/column_family.rb', line 15 def initialize(args = {}) @column_descriptor = case args when Apache::Hadoop::Hbase::Thrift::ColumnDescriptor args when Hash Apache::Hadoop::Hbase::Thrift::ColumnDescriptor.new(self.class.translate_hash(args)) end end |
Instance Attribute Details
#column_descriptor ⇒ Object (readonly)
Returns the value of attribute column_descriptor.
14 15 16 |
# File 'lib/hbase_adapter/column_family.rb', line 14 def column_descriptor @column_descriptor end |
Class Method Details
.translate_hash(hash) ⇒ Object
9 10 11 |
# File 'lib/hbase_adapter/column_family.rb', line 9 def translate_hash(hash) Hash[*(hash.map {|(k,v)| [KEY_MAP[k.to_sym], v]}.flatten)] end |
Instance Method Details
#max_versions ⇒ Object
28 29 30 |
# File 'lib/hbase_adapter/column_family.rb', line 28 def max_versions column_descriptor.maxVersions end |
#name ⇒ Object
24 25 26 |
# File 'lib/hbase_adapter/column_family.rb', line 24 def name column_descriptor.name end |