linodians 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c67f30c1c4f6422cb01b7047f87e7c7ee645cd1c
4
- data.tar.gz: 996a21281823ad86fc5a3b252b2b1f3e4beb019d
3
+ metadata.gz: 6c5351346d7a9b25ef7bb381e92baf47f73939b3
4
+ data.tar.gz: 9dd43246770b718e2330d3eb1d408c1fc52f43e8
5
5
  SHA512:
6
- metadata.gz: 91153294f21bf147d8cd922af92b4c81fef6d65304e6a4b6dd2c914b432caf9fb3a94f55eb07bbb04ad6132c739472432688973fd4d060c17d0d64d68340865e
7
- data.tar.gz: 4f786446c12f4a03e180152ee020a97a2b4d78aecb75fbb958dc2c2d8e9f3f3140f0b29e1581a71866be9a83814abc74c2fd4087f04752d0f79fda42d0964a0b
6
+ metadata.gz: 60302b7bebb1a9043b7cbf98ba8c6ea3c9891016058154eaa3fd978d9a56c97b9b255f83ca69351cf11314fa1222ec47ba22c875b9c3cb9a9f164dc7cf599735
7
+ data.tar.gz: 20d13529a3c62a529d444c38f91e817da21615d502b02efc0169f2e754ba02b50d665ccb351c6ffac0a907b15a468f7046dfdb76ba9076d2ef32a694d5b7c9ba
data/README.md CHANGED
@@ -12,6 +12,21 @@ Library for viewing public Linode employee data
12
12
 
13
13
  ## Usage
14
14
 
15
+ ### From the command line
16
+
17
+ A `linodians` script is provided that will output the current data:
18
+
19
+ ```
20
+ ❯ linodians -h
21
+ Usage: linodians [-v] [-j]
22
+ -j, --json Output as json
23
+ -v, --version Show version
24
+ ```
25
+
26
+ Running just `linodians` will print a human-readable list. For consumption by other tools, `linodians -j` will output JSON.
27
+
28
+ ### From Ruby code
29
+
15
30
  First, create a Linodian object
16
31
 
17
32
  ```
@@ -55,6 +70,18 @@ titles = employees.map(&:title).each_with_object(Hash.new(0)) { |i, o| o[i] += 1
55
70
  titles.sort_by(&:last).each { |title, count| puts "#{count} -- #{title}" }
56
71
  ```
57
72
 
73
+ #### Loading in existing data
74
+
75
+ 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:
76
+
77
+ ```
78
+ require 'linodians'
79
+ require 'json'
80
+
81
+ data = File.open('data.json') { |fh| JSON.parse fh }
82
+ linodians = Linodians.new(data)
83
+ ```
84
+
58
85
  ## Installation
59
86
 
60
87
  gem install linodians
@@ -7,8 +7,8 @@ module Linodians
7
7
  attr_reader :members
8
8
  alias_method :__getobj__, :members
9
9
 
10
- def initialize
11
- @members = Linodians.download_data
10
+ def initialize(data = nil)
11
+ @members = data || Linodians.download_data
12
12
  @members.freeze
13
13
  super(@members)
14
14
  end
@@ -1,5 +1,5 @@
1
1
  ##
2
2
  # Define the version
3
3
  module Linodians
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linodians
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker