class JsonCli::CLI
CLI
class
Public Instance Methods
inner_join()
click to toggle source
# File lib/json_cli/cli.rb, line 28 def inner_join join_common(__method__) end
left_join()
click to toggle source
# File lib/json_cli/cli.rb, line 12 def left_join join_common(__method__) end
right_join()
click to toggle source
# File lib/json_cli/cli.rb, line 20 def right_join join_common(__method__) end
unwind_array(json_file = '/dev/stdin')
click to toggle source
# File lib/json_cli/cli.rb, line 34 def unwind_array(json_file = '/dev/stdin') unwind_common(__method__, json_file) end
unwind_hash(json_file = '/dev/stdin')
click to toggle source
# File lib/json_cli/cli.rb, line 43 def unwind_hash(json_file = '/dev/stdin') unwind_common(__method__, json_file) end
Private Instance Methods
join_common(command)
click to toggle source
# File lib/json_cli/cli.rb, line 49 def join_common(command) left_io = File.open(options[:base_file], 'r') right_io = File.open(options[:join_file], 'r') JsonCli::Command::Join.new(left_io, right_io, opts).send(command) [left_io, right_io, opts[:out]].each(&:close) end
opts()
click to toggle source
# File lib/json_cli/cli.rb, line 62 def opts @opts ||= { out: File.open(options[:output], 'w') } .merge(options.select { |key, _| key != :output }) .each_with_object({}) do |(key, val), hash| hash[key.to_sym] = val end end
unwind_common(command, json_file)
click to toggle source
# File lib/json_cli/cli.rb, line 56 def unwind_common(command, json_file) io = File.open(json_file, 'r') JsonCli::Command::Unwind.new(io, opts).send(command) [io, opts[:out]].each(&:close) end