cliutils 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.yardoc/checksums +11 -11
  4. data/.yardoc/object_types +0 -0
  5. data/.yardoc/objects/root.dat +0 -0
  6. data/Gemfile.lock +12 -33
  7. data/README.md +1 -1
  8. data/Rakefile +36 -31
  9. data/cliutils.gemspec +3 -2
  10. data/lib/cliutils/configuration.rb +13 -31
  11. data/lib/cliutils/configurator.rb +23 -62
  12. data/lib/cliutils/ext/Hash+Extensions.rb +39 -78
  13. data/lib/cliutils/ext/Logger+Extensions.rb +6 -11
  14. data/lib/cliutils/ext/String+Extensions.rb +25 -13
  15. data/lib/cliutils/logger-delegator.rb +15 -39
  16. data/lib/cliutils/messenging.rb +10 -28
  17. data/lib/cliutils/prefs.rb +18 -43
  18. data/lib/cliutils/pretty-io.rb +59 -127
  19. data/lib/cliutils/version.rb +2 -1
  20. data/lib/cliutils.rb +2 -0
  21. metadata +20 -32
  22. data/bin/cliutils +0 -38
  23. data/doc/CLIUtils/Configuration.html +0 -373
  24. data/doc/CLIUtils/Configurator.html +0 -873
  25. data/doc/CLIUtils/LoggerDelegator.html +0 -560
  26. data/doc/CLIUtils/Messenging.html +0 -396
  27. data/doc/CLIUtils/Prefs.html +0 -609
  28. data/doc/CLIUtils/PrettyIO.html +0 -1333
  29. data/doc/CLIUtils.html +0 -131
  30. data/doc/Hash.html +0 -672
  31. data/doc/Logger.html +0 -233
  32. data/doc/String.html +0 -562
  33. data/doc/_index.html +0 -207
  34. data/doc/class_list.html +0 -54
  35. data/doc/css/common.css +0 -1
  36. data/doc/css/full_list.css +0 -57
  37. data/doc/css/style.css +0 -339
  38. data/doc/file.README.html +0 -415
  39. data/doc/file_list.html +0 -56
  40. data/doc/frames.html +0 -26
  41. data/doc/index.html +0 -415
  42. data/doc/js/app.js +0 -219
  43. data/doc/js/full_list.js +0 -178
  44. data/doc/js/jquery.js +0 -4
  45. data/doc/method_list.html +0 -389
  46. data/doc/top-level-namespace.html +0 -114
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0661e149b08f88960de4184a7a8da5532a63d97
4
- data.tar.gz: 613a4708ec59139915d4e586d94270f2b043c1c2
3
+ metadata.gz: ed57d1bb3f3c3248b082ff1ea8a5159a2e68052b
4
+ data.tar.gz: 9fb6dc3532170cdcf2ef15239d99c199fb1ef04f
5
5
  SHA512:
6
- metadata.gz: 2f797db44c6134ad992452ef1a352e6c3a56df8c30d0d2b8d6877c5150abcfb012813666841f582df8e75371479ca4e95a39b99699bc2febc3aeb5b4e258ded8
7
- data.tar.gz: 5cf08cd508662ba10b2e0c10160abc7444703a8f0d4201be3b231cd982524089eb8d13054dd31766325a21185e3c3cada016d99a4418a242c5fac94f22fafa66
6
+ metadata.gz: da2909f0c9d6de3f3e75698b09414ea999e364894435dc7843334351568b89f5fa6292215ff7e67546b5b5918afa80083885f3b735ef303a202fc94492faf9f8
7
+ data.tar.gz: efd71929d34adea0cadecd3cc6865f48a5b3cff101de2060084994369d56f50b37d57e4a1921fb49aa9c04d16d737c3bfd38307f99580f18f2e0105af9c461bc
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
1
  .DS_Store
2
+ doc
3
+ pkg
data/.yardoc/checksums CHANGED
@@ -1,11 +1,11 @@
1
- lib/cliutils.rb d9df8016853e34d15d313e4b31e9372f774e1a1e
2
- lib/cliutils/prefs.rb ff05c575b2b369a1ddf4c1a2b5d967817dca9169
3
- lib/cliutils/version.rb 878b4b132480b6f152a92bfb25d3df9ec01afb68
4
- lib/cliutils/pretty-io.rb cb9180bfab92bac8de7d2596bca1d75b75bbd5e4
5
- lib/cliutils/messenging.rb 4a09e017169a879edc9721039452021a8bed2744
6
- lib/cliutils/configurator.rb 66021010c3d747db51917eab88f1d249ce4fe03a
7
- lib/cliutils/configuration.rb 1de2d1b17294954071ddda7227a71501d07a8ae3
8
- lib/cliutils/logger-delegator.rb e8f2454faf305ed1a7a882e15a87a683684bb333
9
- lib/cliutils/ext/Hash+Extensions.rb e47f73d02132978ed166e8f7d320b147a9397ea1
10
- lib/cliutils/ext/Logger+Extensions.rb f37fc1c860e1f1ccca1671c8ae09cac23e4a2812
11
- lib/cliutils/ext/String+Extensions.rb 651d2853ccb9f94767af1d7199fdc83df44778d7
1
+ lib/cliutils.rb 4f397f5444c33ebcebd8384e5b7b498186785d0d
2
+ lib/cliutils/prefs.rb 66f1c006d76b5334ad4b2b427141796d35065c27
3
+ lib/cliutils/version.rb 70a1622cf96c5c986b312e8b7f5751131090b30e
4
+ lib/cliutils/pretty-io.rb fba4516ec1e2561d1b5e613e4f61b04f03e8abc0
5
+ lib/cliutils/messenging.rb c0362bcb8e1090d83966d2b3596532c7f1576570
6
+ lib/cliutils/configurator.rb c202ac417ea4891c990da586d1edf6333f0fa8d6
7
+ lib/cliutils/configuration.rb 02752324c57b7c7054d9a8158f70641cd73682bc
8
+ lib/cliutils/logger-delegator.rb 507b215088c1d019d42059832ef8280f746ee26b
9
+ lib/cliutils/ext/Hash+Extensions.rb e51f7475afccd3ad38a4a62ddcf87216f2dcc974
10
+ lib/cliutils/ext/Logger+Extensions.rb 946bf8385446f369264877a2fe6bb415f24dbcd8
11
+ lib/cliutils/ext/String+Extensions.rb a0a39b16d1709e7f5c5c4eff0d6d8258e691582d
data/.yardoc/object_types CHANGED
Binary file
Binary file
data/Gemfile.lock CHANGED
@@ -1,48 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cliutils (0.0.1)
5
- methadone (~> 1.3.2)
4
+ cliutils (1.0.3)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
9
8
  specs:
10
- aruba (0.5.4)
11
- childprocess (>= 0.3.6)
12
- cucumber (>= 1.1.1)
13
- rspec-expectations (>= 2.7.0)
14
- builder (3.2.2)
15
- childprocess (0.5.1)
16
- ffi (~> 1.0, >= 1.0.11)
17
- cucumber (1.3.12)
18
- builder (>= 2.1.2)
19
- diff-lcs (>= 1.1.3)
20
- gherkin (~> 2.12)
21
- multi_json (>= 1.7.5, < 2.0)
22
- multi_test (>= 0.1.1)
23
- diff-lcs (1.2.5)
24
- ffi (1.9.3)
25
- gherkin (2.12.2)
26
- multi_json (~> 1.3)
27
- json (1.8.1)
28
- methadone (1.3.2)
29
- bundler
30
- multi_json (1.9.2)
31
- multi_test (0.1.1)
9
+ coderay (1.1.0)
10
+ method_source (0.8.2)
11
+ pry (0.9.12.6)
12
+ coderay (~> 1.0)
13
+ method_source (~> 0.8)
14
+ slop (~> 3.4)
32
15
  rake (0.9.2.2)
33
- rdoc (4.1.1)
34
- json (~> 1.4)
35
- rspec-expectations (3.0.0.beta2)
36
- diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (= 3.0.0.beta2)
38
- rspec-support (3.0.0.beta2)
16
+ slop (3.5.0)
17
+ yard (0.8.7.4)
39
18
 
40
19
  PLATFORMS
41
20
  ruby
42
21
 
43
22
  DEPENDENCIES
44
- aruba
45
23
  bundler (~> 1.5)
46
24
  cliutils!
47
- rake (~> 0.9.2)
48
- rdoc
25
+ pry (~> 0.9)
26
+ rake (~> 0)
27
+ yard (= 0.8.7.4)
data/README.md CHANGED
@@ -45,7 +45,7 @@ include CLIUtils
45
45
 
46
46
  Alternatively, as described below, mix in only the libraries that you want.
47
47
 
48
- Note that although this README.md is extensive, it may not cover all methods. Check out the [tests](https://github.com/bachya/cli-utils/tree/master/test) to see more examples.
48
+ Note that although this README.md is extensive, it may not cover all methods. Check out the [YARD documentation](http://rubydoc.info/github/bachya/cli-utils/master/frames) and the [tests](https://github.com/bachya/cli-utils/tree/master/test) to see more examples.
49
49
 
50
50
  # Libraries
51
51
 
data/Rakefile CHANGED
@@ -1,45 +1,50 @@
1
1
  require 'rake/clean'
2
2
  require 'rubygems'
3
- require 'rubygems/package_task'
4
- require 'rdoc/task'
5
- require 'cucumber'
6
- require 'cucumber/rake/task'
7
- Rake::RDocTask.new do |rd|
8
- rd.main = "README.md"
9
- rd.rdoc_files.include("README.md","lib/**/**/*.rb")
10
- rd.title = 'CLIUtils'
3
+
4
+ def version
5
+ contents = File.read File.expand_path('../lib/cliutils/version.rb', __FILE__)
6
+ contents[/VERSION = "([^"]+)"/, 1]
11
7
  end
12
8
 
13
9
  spec = eval(File.read('cliutils.gemspec'))
14
10
 
15
- Gem::PackageTask.new(spec) do |pkg|
16
- end
17
- CUKE_RESULTS = 'results.html'
18
- CLEAN << CUKE_RESULTS
19
- desc 'Run features'
20
- Cucumber::Rake::Task.new(:features) do |t|
21
- opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
22
- opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
23
- t.cucumber_opts = opts
24
- t.fork = false
25
- end
26
-
27
- desc 'Run features tagged as work-in-progress (@wip)'
28
- Cucumber::Rake::Task.new('features:wip') do |t|
29
- tag_opts = ' --tags ~@pending'
30
- tag_opts = ' --tags @wip'
31
- t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
32
- t.fork = false
11
+ require 'yard'
12
+ desc 'Create YARD documentation'
13
+ YARD::Rake::YardocTask.new do |t|
33
14
  end
34
15
 
35
- task :cucumber => :features
36
- task 'cucumber:wip' => 'features:wip'
37
- task :wip => 'features:wip'
38
-
39
16
  require 'rake/testtask'
17
+ desc 'Run unit tests'
40
18
  Rake::TestTask.new do |t|
41
19
  t.libs << "test"
42
20
  t.test_files = FileList['test/*_test.rb']
43
21
  end
44
22
 
45
- task :default => [:test]
23
+ require 'pry'
24
+ desc 'Open up a PRY session with this gem loaded'
25
+ task :pry do
26
+ puts version
27
+ end
28
+
29
+ desc "Release CLIUtils version #{version}"
30
+ task :release => :build do
31
+ unless `git branch` =~ /^\* master$/
32
+ puts "You must be on the master branch to release!"
33
+ exit!
34
+ end
35
+
36
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
37
+ sh "git tag v#{version}"
38
+ sh "git push origin master"
39
+ sh "git push origin v#{version}"
40
+ sh "gem push pkg/cliutils-#{version}.gem"
41
+ end
42
+
43
+ desc "Build the gem"
44
+ task :build do
45
+ FileUtils.mkdir_p "pkg"
46
+ sh "gem build cliutils.gemspec"
47
+ FileUtils.mv("./cliutils-#{version}.gem", "pkg")
48
+ end
49
+
50
+ task :default => :test
data/cliutils.gemspec CHANGED
@@ -22,7 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.extra_rdoc_files = ['README.md', 'doc']
23
23
  spec.rdoc_options << '--title' << 'CLIUtils' << '--main' << 'README.md' << '-ri'
24
24
 
25
- spec.add_development_dependency("bundler", "~> 1.5")
26
- spec.add_development_dependency('rdoc', '~> 0')
25
+ spec.add_development_dependency('bundler', '~> 1.5')
26
+ spec.add_development_dependency('pry', '~> 0.9')
27
27
  spec.add_development_dependency('rake', '~> 0')
28
+ spec.add_development_dependency('yard', '0.8.7.4')
28
29
  end
@@ -1,46 +1,28 @@
1
1
  require 'yaml'
2
2
 
3
3
  module CLIUtils
4
- # ======================================================
5
- # Configuration Class
6
- #
7
- # Manages any configuration values and the flat YAML file
8
- # into which they get stored.
9
- # ======================================================
4
+ # Configuration Module
5
+ # Manages any configuration values and the flat YAML file
6
+ # into which they get stored.
10
7
  module Configuration
11
- # ====================================================
12
- # Methods
13
- # ====================================================
14
- # ----------------------------------------------------
15
- # included method
16
- #
17
- # Hook called when this module gets mixed in; extends
18
- # the includer with the methods defined here.
19
- # @param k The includer
20
- # @return Void
21
- # ----------------------------------------------------
8
+ # Hook that triggers when this module is included.
9
+ # @param [Object] k The includer object
10
+ # @return [void]
22
11
  def self.included(k)
23
12
  k.extend(self)
24
13
  end
25
14
 
26
- # ----------------------------------------------------
27
- # configuration method
28
- #
29
- # Singleton method to return (or initialize, if needed)
30
- # a Configurator.
31
- # @return Configurator
32
- # ----------------------------------------------------
15
+ # Singleton method to return (or initialize, if needed)
16
+ # a Configurator.
17
+ # @return [Configurator]
33
18
  def configuration
34
19
  @configuration ||= Configurator.new('~/.default-cliutils')
35
20
  end
36
21
 
37
- # ----------------------------------------------------
38
- # load_configuration method
39
- #
40
- # Initializes a Configurator with the passed filepath.
41
- # @param path The path to the config file
42
- # @return Void
43
- # ----------------------------------------------------
22
+ # Singleton method to return (or initialize, if needed)
23
+ # a Configurator.
24
+ # @param [String] path The filepath to use
25
+ # @return [void]
44
26
  def load_configuration(path)
45
27
  @configuration = Configurator.new(path)
46
28
  end
@@ -1,28 +1,15 @@
1
1
  require 'yaml'
2
2
 
3
3
  module CLIUtils
4
- # ======================================================
5
4
  # Configuration Class
6
- #
7
5
  # Manages any configuration values and the flat YAML file
8
6
  # into which they get stored.
9
- # ======================================================
10
7
  class Configurator
11
- # ====================================================
12
- # Attributes
13
- # ====================================================
14
8
  attr_reader :config_path, :data
15
9
 
16
- # ====================================================
17
- # Methods
18
- # ====================================================
19
- # ----------------------------------------------------
20
- # initialize method
21
- #
22
- # Initializes configuration from a flat file.
23
- # @param path The filepath to the config YAML
24
- # @return void
25
- # ----------------------------------------------------
10
+ # Initializes configuration from a flat file.
11
+ # @param [String] path The filepath to the config YAML
12
+ # @return [void]
26
13
  def initialize(path)
27
14
  _path = File.expand_path(path)
28
15
  @config_path = _path
@@ -34,14 +21,10 @@ module CLIUtils
34
21
  end
35
22
  end
36
23
 
37
- # ----------------------------------------------------
38
- # add_section method
39
- #
40
- # Adds a new section to the config file (if it doesn't
41
- # already exist).
42
- # @param section_name The section to add
43
- # @return Void
44
- # ----------------------------------------------------
24
+ # Adds a new section to the config file (if it doesn't
25
+ # already exist).
26
+ # @param [String] section_name The section to add
27
+ # @return [void]
45
28
  def add_section(section_name)
46
29
  if !@data.key?(section_name)
47
30
  @data[section_name] = {}
@@ -50,13 +33,9 @@ module CLIUtils
50
33
  end
51
34
  end
52
35
 
53
- # ----------------------------------------------------
54
- # delete_section method
55
- #
56
- # Removes a section to the config file (if it exists).
57
- # @param section_name The section to remove
58
- # @return Void
59
- # ----------------------------------------------------
36
+ # Removes a section to the config file (if it exists).
37
+ # @param [String] section_name The section to remove
38
+ # @return [void]
60
39
  def delete_section(section_name)
61
40
  if @data.key?(section_name)
62
41
  @data.delete(section_name)
@@ -65,14 +44,10 @@ module CLIUtils
65
44
  end
66
45
  end
67
46
 
68
- # ----------------------------------------------------
69
- # ingest_prefs method
70
- #
71
- # Ingests a Prefs class and adds its answers to the
72
- # configuration data.
73
- # @param prefs The Prefs class to examine
74
- # @return Void
75
- # ----------------------------------------------------
47
+ # Ingests a Prefs class and adds its answers to the
48
+ # configuration data.
49
+ # @param [Prefs] prefs The Prefs class to examine
50
+ # @return [void]
76
51
  def ingest_prefs(prefs)
77
52
  fail 'Invaid Prefs class' if !prefs.kind_of?(Prefs) || prefs.answers.nil?
78
53
  prefs.answers.each do |p|
@@ -81,37 +56,23 @@ module CLIUtils
81
56
  end
82
57
  end
83
58
 
84
- # ----------------------------------------------------
85
- # method_missing method
86
- #
87
- # Allows this module to return data from the config
88
- # Hash when given a method name that matches a key.
89
- # @param name
90
- # @param *args
91
- # @param &block
92
- # @return Hash
93
- # ----------------------------------------------------
59
+ # Hook that fires when a non-existent method is called.
60
+ # Allows this module to return data from the config
61
+ # Hash when given a method name that matches a key.
62
+ # @return [Hash]
94
63
  def method_missing(name, *args, &block)
95
64
  @data[name.to_sym] || @data.merge!(name.to_sym => {})
96
65
  end
97
66
 
98
- # ----------------------------------------------------
99
- # reset method
100
- #
101
- # Clears the configuration data.
102
- # @return Void
103
- # ----------------------------------------------------
67
+ # Clears the configuration data.
68
+ # @return [void]
104
69
  def reset
105
70
  @data = {}
106
71
  end
107
72
 
108
- # ----------------------------------------------------
109
- # save method
110
- #
111
- # Saves the configuration data to the previously
112
- # stored flat file.
113
- # @return Void
114
- # ----------------------------------------------------
73
+ # Saves the configuration data to the previously
74
+ # stored flat file.
75
+ # @return [void]
115
76
  def save
116
77
  File.open(@config_path, 'w') { |f| f.write(@data.deep_stringify_keys.to_yaml) }
117
78
  end
@@ -1,21 +1,12 @@
1
- # ======================================================
2
- # Hash Class
3
- #
4
- # Contains many convenient methods borrowed from Rails
5
- # http://api.rubyonrails.org/classes/Hash.html
6
- # ======================================================
1
+ # Hash Class
2
+ # Contains many convenient methods borrowed from Rails
3
+ # http://api.rubyonrails.org/classes/Hash.html
7
4
  class Hash
8
- # ====================================================
9
- # Methods
10
- # ====================================================
11
- # ----------------------------------------------------
12
- # deep_merge! method
13
- #
14
- # Deep merges a hash into the current one.
15
- # @param other_hash The hash to merge in
16
- # @param &block
17
- # @return Hash
18
- # ----------------------------------------------------
5
+
6
+ # Deep merges a hash into the current one.
7
+ # @param [Hash] other_hash The hash to merge in
8
+ # @yield &block
9
+ # @return [Hash]
19
10
  def deep_merge!(other_hash, &block)
20
11
  other_hash.each_pair do |k,v|
21
12
  tv = self[k]
@@ -28,84 +19,58 @@ class Hash
28
19
  self
29
20
  end
30
21
 
31
- # ----------------------------------------------------
32
- # deep_stringify_keys method
33
- #
34
- # Recursively turns all Hash keys into strings and
35
- # returns the new Hash.
36
- # @return Hash
37
- # ----------------------------------------------------
22
+ # Recursively turns all Hash keys into strings and
23
+ # returns the new Hash.
24
+ # @return [Hash]
38
25
  def deep_stringify_keys
39
26
  deep_transform_keys{ |key| key.to_s }
40
27
  end
41
28
 
42
- # ----------------------------------------------------
43
- # deep_symbolize_keys! method
44
- #
45
- # Same as deep_stringify_keys, but destructively
46
- # alters the original Hash.
47
- # @return Hash
48
- # ----------------------------------------------------
29
+ # Same as deep_stringify_keys, but destructively
30
+ # alters the original Hash.
31
+ # @return [Hash]
49
32
  def deep_stringify_keys!
50
33
  deep_transform_keys!{ |key| key.to_s }
51
34
  end
52
35
 
53
- # ----------------------------------------------------
54
- # deep_symbolize_keys method
55
- #
56
- # Recursively turns all Hash keys into symbols and
57
- # returns the new Hash.
58
- # @return Hash
59
- # ----------------------------------------------------
36
+ # Recursively turns all Hash keys into symbols and
37
+ # returns the new Hash.
38
+ # @return [Hash]
60
39
  def deep_symbolize_keys
61
40
  deep_transform_keys{ |key| key.to_sym rescue key }
62
41
  end
63
42
 
64
- # ----------------------------------------------------
65
- # deep_symbolize_keys! method
66
- #
67
- # Same as deep_symbolize_keys, but destructively
68
- # alters the original Hash.
69
- # @return Hash
70
- # ----------------------------------------------------
43
+ # Same as deep_symbolize_keys, but destructively
44
+ # alters the original Hash.
45
+ # @return [Hash]
71
46
  def deep_symbolize_keys!
72
47
  deep_transform_keys!{ |key| key.to_sym rescue key }
73
48
  end
74
49
 
75
- # ----------------------------------------------------
76
- # deep_transform_keys method
77
- #
78
- # Generic method to perform recursive operations on a
79
- # Hash.
80
- # @return Hash
81
- # ----------------------------------------------------
50
+ # Generic method to perform recursive operations on a
51
+ # Hash.
52
+ # @yield &block
53
+ # @return [Hash]
82
54
  def deep_transform_keys(&block)
83
55
  _deep_transform_keys_in_object(self, &block)
84
56
  end
85
57
 
86
- # ----------------------------------------------------
87
- # deep_transform_keys! method
88
- #
89
- # Same as deep_transform_keys, but destructively
90
- # alters the original Hash.
91
- # @return Hash
92
- # ----------------------------------------------------
58
+ # Same as deep_transform_keys, but destructively
59
+ # alters the original Hash.
60
+ # @yield &block
61
+ # @return [Hash]
93
62
  def deep_transform_keys!(&block)
94
63
  _deep_transform_keys_in_object!(self, &block)
95
64
  end
96
65
 
97
66
  private
98
67
 
99
- # ----------------------------------------------------
100
- # _deep_transform_keys_in_object method
101
- #
102
- # Modification to deep_transform_keys that allows for
103
- # the existence of arrays.
104
- # https://github.com/rails/rails/pull/9720/files?short_path=4be3c90
105
- # @param object The object to examine
106
- # @param &block A block to execute on the opject
107
- # @return Object
108
- # ----------------------------------------------------
68
+ # Modification to deep_transform_keys that allows for
69
+ # the existence of arrays.
70
+ # https://github.com/rails/rails/pull/9720/files?short_path=4be3c90
71
+ # @param [Object] object The object to examine
72
+ # @yield &block
73
+ # @return [Object]
109
74
  def _deep_transform_keys_in_object(object, &block)
110
75
  case object
111
76
  when Hash
@@ -119,15 +84,11 @@ class Hash
119
84
  end
120
85
  end
121
86
 
122
- # ----------------------------------------------------
123
- # _deep_transform_keys_in_object! method
124
- #
125
- # Same as _deep_transform_keys_in_object, but
126
- # destructively alters the original Object.
127
- # @param object The object to examine
128
- # @param &block A block to execute on the opject
129
- # @return Object
130
- # ----------------------------------------------------
87
+ # Same as _deep_transform_keys_in_object, but
88
+ # destructively alters the original Object.
89
+ # @param [Object] The object to examine
90
+ # @yield &block
91
+ # @return [Object]
131
92
  def _deep_transform_keys_in_object!(object, &block)
132
93
  case object
133
94
  when Hash
@@ -1,17 +1,12 @@
1
1
  require 'logger'
2
2
 
3
- # ======================================================
4
- # Logger Class
5
- # ======================================================
3
+ # Logger Class extensions
6
4
  class Logger
7
- # ----------------------------------------------------
8
- # custom_level method
9
- #
10
- # Creates a custom Logger level based on the passed
11
- # tag.
12
- # @param tag The Logger level to create
13
- # @return Void
14
- # ----------------------------------------------------
5
+
6
+ # Creates a custom Logger level based on the passed
7
+ # tag.
8
+ # @param [String] tag The Logger level to create
9
+ # @return [void]
15
10
  def self.custom_level(tag)
16
11
  SEV_LABEL << tag
17
12
  idx = SEV_LABEL.size - 1
@@ -1,26 +1,38 @@
1
- # ======================================================
2
- # String Class
3
- # ======================================================
1
+ # String Class extensions
4
2
  class String
5
- # ====================================================
6
- # Color String Methods
7
- # ====================================================
8
- # ----------------------------------------------------
9
- # colorize method
10
- #
11
- # Outputs a string in a formatted color.
12
- # @param color_code The code to use
13
- # @return Void
14
- # ----------------------------------------------------
3
+
4
+ # Outputs a string in a formatted color.
5
+ # @param [<Integer, String>] color_code The code to use
6
+ # @return [void]
15
7
  def colorize(color_code)
16
8
  "\033[#{ color_code }m#{ self }\033[0m"
17
9
  end
18
10
 
11
+ # Makes the associated string blue.
12
+ # @return [void]
19
13
  def blue; colorize(34) end
14
+
15
+ # Makes the associated string cyan.
16
+ # @return [void]
20
17
  def cyan; colorize(36) end
18
+
19
+ # Makes the associated string green.
20
+ # @return [void]
21
21
  def green; colorize(32) end
22
+
23
+ # Makes the associated string purple.
24
+ # @return [void]
22
25
  def purple; colorize(35) end
26
+
27
+ # Makes the associated string red.
28
+ # @return [void]
23
29
  def red; colorize(31) end
30
+
31
+ # Makes the associated string white.
32
+ # @return [void]
24
33
  def white; colorize(37) end
34
+
35
+ # Makes the associated string yellow.
36
+ # @return [void]
25
37
  def yellow; colorize(33) end
26
38
  end