class Evostream::CLI::Search

Search data in evostream result

Public Class Methods

new() click to toggle source
# File lib/evostream/cli/search.rb, line 9
def initialize
  @response = nil
  @search = CLI::Argument::Search.instance.search.split(': ')
end

Public Instance Methods

search_node(result) click to toggle source
# File lib/evostream/cli/search.rb, line 14
def search_node(result)
  YAML.load(result.to_yaml).each_value do |value|
    inspect_array(value) if value.is_a?(Array) && !value.empty?
  end

  puts @response.nil? ? "No node equal to #{@search}" : @response
end

Private Instance Methods

inspect_array(evostream_response) click to toggle source
# File lib/evostream/cli/search.rb, line 24
def inspect_array(evostream_response)
  evostream_response.each do |value|
    inspect_hash(value)
  end
end
inspect_hash(evostream_response) click to toggle source
# File lib/evostream/cli/search.rb, line 30
def inspect_hash(evostream_response)
  evostream_response.each do |hash_value|
    puts value.to_yaml if hash_value == @search
  end
end