potrubi 0.0.1 → 0.0.2

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.
@@ -0,0 +1,53 @@
1
+
2
+ # potrubi mixin util
3
+
4
+ # various useful methods
5
+
6
+ require_relative '../core'
7
+
8
+ #requireList = %w(bootstrap)
9
+ #requireList.each {|r| require_relative "#{r}"}
10
+
11
+ mixinContent = Module.new do
12
+
13
+ #=begin
14
+ def potrubi_util_merge_hashes_or_croak(*hashes)
15
+ r = hashes.flatten.compact.inject({}) {|s, h| s.merge(potrubi_bootstrap_mustbe_hash_or_croak(h))}
16
+ r.empty? ? nil : r
17
+ end
18
+ alias_method :potrubi_util_merge_hashes, :potrubi_util_merge_hashes_or_croak
19
+ #=end
20
+
21
+ # Apply a proc to the hash values and return a new hash with new values
22
+
23
+ #=begin
24
+ def potrubi_util_apply_proc_to_hash_or_croak(srceHash, &srceBlok)
25
+ mustbe_proc_or_croak(srceBlok)
26
+ mustbe_hash_or_croak(srceHash).each_with_object({}) {|(k,v),h| h[k] = srceBlok.call(k, v) }
27
+ end
28
+ alias_method :potrubi_util_map_hash_value, :potrubi_util_apply_proc_to_hash_or_croak
29
+ alias_method :potrubi_util_map_hash_v, :potrubi_util_apply_proc_to_hash_or_croak
30
+ #=end
31
+ #=begin
32
+ def potrubi_util_map_hash_key_and_value_or_croak(srceHash, &srceBlok)
33
+ mustbe_proc_or_croak(srceBlok)
34
+ mustbe_hash_or_croak(srceHash).each_with_object({}) {|(k,v),h| r = mustbe_array_or_croak(srceBlok.call(k, v)); h[r[0]] = r[1] }
35
+ end
36
+ alias_method :potrubi_util_map_hash_kv, :potrubi_util_map_hash_key_and_value_or_croak
37
+ #=end
38
+
39
+ #=begin
40
+ def potrubi_util_array_to_hash(aVal, &procBlok)
41
+ mustbe_array_or_croak(aVal)
42
+ case
43
+ when Kernel.block_given? then aVal.each_with_object({}) {|a, h| r = mustbe_array_or_croak(procBlok.call(a)); h[r[0]] = r[1] } # k&v from proc
44
+ else
45
+ aVal.each_with_object({}) {|a, h| h[a] = nil } # values to nil
46
+ end
47
+ end
48
+ #=end
49
+ end
50
+
51
+ Potrubi::Core.assign_module_constant_or_croak(mixinContent, __FILE__)
52
+
53
+ __END__
@@ -2,5 +2,5 @@
2
2
  # Version for Potrubi
3
3
 
4
4
  module Potrubi
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.2"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: potrubi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,18 +9,40 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-22 00:00:00.000000000 Z
12
+ date: 2013-01-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: ! 'Potrubi: A collection of mixins for Common Ruby needs'
14
+ description: ! 'Potrubi: A collection of Ruby mixins for common needs'
15
15
  email:
16
16
  - ian@rumford.name
17
17
  executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - README.md
22
+ - lib/potrubi.rb
23
+ - lib/potrubi/bootstrap.rb
24
+ - lib/potrubi/core.rb
25
+ - lib/potrubi/klass/syntax/braket.rb
26
+ - lib/potrubi/mixin/bootstrap_common.rb
27
+ - lib/potrubi/mixin/configuration.rb
28
+ - lib/potrubi/mixin/contract-recipes.rb
29
+ - lib/potrubi/mixin/contract.rb
30
+ - lib/potrubi/mixin/dynamic-recipes.rb
31
+ - lib/potrubi/mixin/dynamic.rb
32
+ - lib/potrubi/mixin/exception.rb
33
+ - lib/potrubi/mixin/filesys.rb
34
+ - lib/potrubi/mixin/initialize.rb
35
+ - lib/potrubi/mixin/konstant.rb
36
+ - lib/potrubi/mixin/logger.rb
37
+ - lib/potrubi/mixin/pathandnames.rb
38
+ - lib/potrubi/mixin/persistence.rb
39
+ - lib/potrubi/mixin/script.rb
40
+ - lib/potrubi/mixin/text-snippets.rb
41
+ - lib/potrubi/mixin/text-snippets/methods-text-snippets.rb
42
+ - lib/potrubi/mixin/util.rb
21
43
  - lib/potrubi/potrubi.rb
22
44
  - lib/potrubi/version.rb
23
- homepage: ''
45
+ homepage: https://github.com/ianrumford/potrubi
24
46
  licenses: []
25
47
  post_install_message:
26
48
  rdoc_options: []
@@ -31,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
31
53
  requirements:
32
54
  - - ! '>='
33
55
  - !ruby/object:Gem::Version
34
- version: '0'
56
+ version: 1.9.3
35
57
  required_rubygems_version: !ruby/object:Gem::Requirement
36
58
  none: false
37
59
  requirements: