lib/ej/commands.rb in ej-0.0.12 vs lib/ej/commands.rb in ej-0.1.0

- old
+ new

@@ -2,20 +2,17 @@ # coding: utf-8 require 'thor' require 'yajl' require 'elasticsearch' require 'ej/core' -require 'active_support/core_ext/array' -require 'active_support/core_ext/string' require 'logger' module Ej class Commands < Thor class_option :index, aliases: '-i', type: :string, default: '_all', desc: 'index' class_option :host, aliases: '-h', type: :string, default: 'localhost', desc: 'host' class_option :debug, aliases: '-d', type: :string, default: false, desc: 'debug mode' - class_option :format, type: :string, default: 'json', enum: ['json', 'yaml'], desc: 'format' map '-s' => :search map '-f' => :facet map '-c' => :count map '-b' => :bulk @@ -232,22 +229,10 @@ end private def puts_with_format(object) - if options['format'] == 'json' - puts_json(object) - elsif options['format'] == 'yaml' - puts_yaml(object) - end - end - - def puts_json(object) puts Yajl::Encoder.encode(object, pretty: true) - end - - def puts_yaml(object) - puts YAML.dump(object) end end end