shuttle_cli 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 133346c8ebd092e855e5bb1747aeb5b65d36350c
4
- data.tar.gz: 149f8dd579dba411ec55a818d5846ca2f78ebe5e
3
+ metadata.gz: fad23e01fe3de79bc2b213efc1df275f06210296
4
+ data.tar.gz: 50fdfd4f98023771c05b436211646146b90b5e0c
5
5
  SHA512:
6
- metadata.gz: c63008f1a98ba692d7b7d411620effdb41f0be2b6e64cc0fd982fb32efd5f5531ac69b3d28cf05c0f38e14d2f9ea58d4dda1e58b970533ed2b7f02f071112e89
7
- data.tar.gz: 2d64856f15013e4060c9ddef5c6293ba3faa4d75992d51bdf17e94459577c484da372a76a0bb49d327b9262bc9b187f6150554f99b2861c8cbcea0400848f6b8
6
+ metadata.gz: 3cc464ddd40cc3ca07152ebd35152ee0b1189aa57ca86b80f904dff5f27105dd01d52234c67b534650d229d86f3f678138a12a475fc1d5587e68a0b17891e47e
7
+ data.tar.gz: 169c7f584ff5e59afe752a39c9d2fc8022c0b15526a17dfd07d67f15ffe2894cb3761679050546579409572b1fad5cadddd0a53c97334951e8adcbb4958879c5
@@ -1,29 +1,38 @@
1
1
  module ShuttleCli
2
2
  class Bookmark
3
- attr_accessor :children, :name, :cmd, :number
3
+ attr_accessor :children, :name, :cmd, :number, :parent
4
4
 
5
5
  @@bookmark_number = 1
6
6
 
7
- def self.new_from_json json
7
+ def self.new_from_json json, parent: nil
8
8
  obj = new
9
9
  # We are looking at a deep nested hash if we have more than 1 values.
10
10
  if json.length == 1
11
11
  obj.name = json.keys.first
12
12
  obj.children = json.values.flatten.map do |h|
13
13
  # Recursive extract again
14
- new_from_json h
14
+ new_from_json h, parent: obj
15
15
  end
16
16
  else
17
17
  obj.name = json[:name]
18
18
  obj.cmd = json[:cmd]
19
19
  end
20
+ obj.parent = parent
20
21
  obj.number = @@bookmark_number
21
22
  @@bookmark_number += 1
22
23
  obj
23
24
  end
24
25
 
26
+ def build_name
27
+ if parent
28
+ "#{parent.name} - #{name}"
29
+ else
30
+ name
31
+ end
32
+ end
33
+
25
34
  def to_a
26
- [number, name, cmd]
35
+ [number, build_name, cmd]
27
36
  end
28
37
 
29
38
  def connect
@@ -1,3 +1,3 @@
1
1
  module ShuttleCli
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shuttle_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Kleinwaechter