GFunk911-mharris_ext 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 4
3
- :patch: 1
3
+ :patch: 2
4
4
  :major: 1
@@ -0,0 +1,13 @@
1
+ class Object
2
+ def attr_accessor_nn_one(sym)
3
+ define_method(sym) do
4
+ res = instance_variable_get("@#{sym}")
5
+ raise "method #{sym} cannot return nil value" unless res
6
+ res
7
+ end
8
+ attr_writer(sym)
9
+ end
10
+ def attr_accessor_nn(*args)
11
+ args.flatten.each { |x| attr_accessor_nn_one(x) }
12
+ end
13
+ end
@@ -1,6 +1,17 @@
1
1
  def tm(msg="Thing")
2
2
  t = Time.now
3
- yield
3
+ res = yield
4
4
  seconds = Time.now - t
5
5
  puts "#{msg} took #{seconds} seconds"
6
- end
6
+ res
7
+ end
8
+
9
+ def print_memory_usage!
10
+ Thread.new do
11
+ loop do
12
+ mem = `ps -l #{Process.pid}`.to_a[1].split[8]
13
+ puts "Memory: #{mem} #{Time.now}"
14
+ sleep(10)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ class Time
2
+ def short_dt
3
+ strftime("%m/%d %H:%M:%S")
4
+ end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: GFunk911-mharris_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Harris
@@ -44,6 +44,7 @@ extra_rdoc_files:
44
44
  files:
45
45
  - VERSION.yml
46
46
  - lib/mharris_ext
47
+ - lib/mharris_ext/accessor.rb
47
48
  - lib/mharris_ext/benchmark.rb
48
49
  - lib/mharris_ext/cmd.rb
49
50
  - lib/mharris_ext/enumerable.rb
@@ -52,6 +53,7 @@ files:
52
53
  - lib/mharris_ext/gems.rb
53
54
  - lib/mharris_ext/methods.rb
54
55
  - lib/mharris_ext/regexp.rb
56
+ - lib/mharris_ext/time.rb
55
57
  - lib/mharris_ext.rb
56
58
  - test/mharris_ext_test.rb
57
59
  - test/test_helper.rb