README.md in linodians-0.0.3 vs README.md in linodians-0.0.4

- old
+ new

@@ -10,10 +10,25 @@ Library for viewing public Linode employee data ## Usage +### From the command line + +A `linodians` script is provided that will output the current data: + +``` +❯ linodians -h +Usage: linodians [-v] [-j] + -j, --json Output as json + -v, --version Show version +``` + +Running just `linodians` will print a human-readable list. For consumption by other tools, `linodians -j` will output JSON. + +### From Ruby code + First, create a Linodian object ``` require 'linodians' employees = Linodians.new @@ -51,9 +66,21 @@ ``` require 'linodians' employees = Linodians.new titles = employees.map(&:title).each_with_object(Hash.new(0)) { |i, o| o[i] += 1 } titles.sort_by(&:last).each { |title, count| puts "#{count} -- #{title}" } +``` + +#### Loading in existing data + +If you already have a hash of data, like one created with `Linodians.new.to_json`, you can import it back in when making a new Linodians object: + +``` +require 'linodians' +require 'json' + +data = File.open('data.json') { |fh| JSON.parse fh } +linodians = Linodians.new(data) ``` ## Installation gem install linodians