Class: Stargate::Response::MetaResponse
- Inherits:
-
BasicResponse
- Object
- BasicResponse
- Stargate::Response::MetaResponse
- Defined in:
- lib/stargate/response/meta_response.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
-
#initialize(raw_data, method) ⇒ MetaResponse
constructor
A new instance of MetaResponse.
- #parse_content(raw_data) ⇒ Object
Methods inherited from BasicResponse
Constructor Details
#initialize(raw_data, method) ⇒ MetaResponse
Returns a new instance of MetaResponse.
6 7 8 9 |
# File 'lib/stargate/response/meta_response.rb', line 6 def initialize(raw_data, method) @method = method super(raw_data) end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/stargate/response/meta_response.rb', line 4 def method @method end |
Instance Method Details
#parse_content(raw_data) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/stargate/response/meta_response.rb', line 11 def parse_content(raw_data) case @method when :list_tables if raw_data.to_s.empty? || raw_data == "null" # "null" from json puts "There are no available tables in the HBase" return [] end tables = [] doc = JSON.parse(raw_data) doc["table"].each do |table| name = table["name"].strip rescue nil t = Model::TableDescriptor.new(:name => name) tables << t end tables else puts "method '#{@method}' not supported yet" end end |