tins 1.0.0 → 1.0.1

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: daf3b23e37e5aaede8874111788fe50b8cde092b
4
- data.tar.gz: 9c1fc6a057ccc8f8fd1e453ce3192dd4c9be3cc9
3
+ metadata.gz: 64c1ef75f9222fd36aa1e009219760aff507f6f6
4
+ data.tar.gz: 12421f59224b1251998f4a8f52463dabf6a1a917
5
5
  SHA512:
6
- metadata.gz: 13370cc1f4ade6e9e275dffd130ab27c8b60fa565aab1d191aad04eee63e449aba0a5a90edb1aba6c89cb4ac56794344530f03bc228758552d9a719b77da5d5e
7
- data.tar.gz: 58c760d2cbcd53e2780364832df9ddf555bd755a73609741969bd813d17a2d368fefeec6ac083c6306cf2f2251f3b310fef7851a880a97078ca92330aa1de38d
6
+ metadata.gz: 117e55dc37155f9eebd73eaed2e40ee78c175f82789c897400404913b8228a7a1b42b903cbabbdc4c4b85c5a72f1103de10d64072107a87f44e9b2af0a069efc
7
+ data.tar.gz: a1768bf14024aa0585f33856c14567dcf157063e11c267bdae6542ffda6a1dfd41f3ad628d108b8026dd107b86aa433b005ae0bdaccd696b547b5a3520dc17ee
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
data/lib/tins/memoize.rb CHANGED
@@ -38,6 +38,7 @@ module Tins
38
38
  result
39
39
  end
40
40
  end
41
+ method_ids.size == 1 ? method_ids.first : method_ids
41
42
  end
42
43
 
43
44
  include CacheMethods
@@ -49,20 +50,21 @@ module Tins
49
50
  function_ids.extend(ExtractLastArgumentOptions)
50
51
  function_ids, opts = function_ids.extract_last_argument_options
51
52
  mc = __memoize_cache__
52
- function_ids.each do |method_id|
53
- method_id = method_id.to_s.to_sym
54
- orig_method = instance_method(method_id)
55
- __send__(:define_method, method_id) do |*args|
56
- if mc.key?(method_id) and result = mc[method_id][args]
53
+ function_ids.each do |function_id|
54
+ function_id = function_id.to_s.to_sym
55
+ orig_function = instance_method(function_id)
56
+ __send__(:define_method, function_id) do |*args|
57
+ if mc.key?(function_id) and result = mc[function_id][args]
57
58
  result
58
59
  else
59
- (mc[method_id] ||= {})[args] = result = orig_method.bind(self).call(*args)
60
+ (mc[function_id] ||= {})[args] = result = orig_function.bind(self).call(*args)
60
61
  opts[:freeze] and result.freeze
61
- $DEBUG and warn "#{self.class} cached function #{method_id}(#{args.inspect unless args.empty?}) = #{result.inspect}"
62
+ $DEBUG and warn "#{self.class} cached function #{function_id}(#{args.inspect unless args.empty?}) = #{result.inspect}"
62
63
  end
63
64
  result
64
65
  end
65
66
  end
67
+ function_ids.size == 1 ? function_ids.first : function_ids
66
68
  end
67
69
  end
68
70
  end
data/lib/tins/null.rb CHANGED
@@ -49,6 +49,13 @@ module Tins
49
49
  true
50
50
  end
51
51
 
52
+ def as_json(*)
53
+ end
54
+
55
+ def to_json(*)
56
+ 'null'
57
+ end
58
+
52
59
  module Kernel
53
60
  def null(value = nil)
54
61
  value.nil? ? Tins::NULL : value
data/lib/tins/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Tins
2
2
  # Tins version
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/tests/null_test.rb CHANGED
@@ -20,6 +20,8 @@ module Tins
20
20
  assert_equal NULL, NULL::NULL
21
21
  assert NULL.nil?
22
22
  assert NULL.blank?
23
+ assert_equal nil, NULL.as_json
24
+ assert_equal 'null', NULL.to_json
23
25
  end
24
26
 
25
27
  def test_null_plus
@@ -35,8 +37,12 @@ module Tins
35
37
  assert_kind_of Tins::NullPlus, NullPlus().foo.bar
36
38
  assert null_plus.nil?
37
39
  assert null_plus().blank?
40
+ assert_equal nil, null_plus().as_json
41
+ assert_equal 'null', null_plus.to_json
38
42
  assert NullPlus().nil?
39
43
  assert NullPlus().blank?
44
+ assert_equal nil, NullPlus().as_json
45
+ assert_equal 'null', NullPlus().to_json
40
46
  end
41
47
 
42
48
  def foo
data/tins.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: tins 1.0.0 ruby lib
2
+ # stub: tins 1.0.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "tins"
6
- s.version = "1.0.0"
6
+ s.version = "1.0.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
10
10
  s.authors = ["Florian Frank"]
11
- s.date = "2014-02-07"
11
+ s.date = "2014-03-19"
12
12
  s.description = "All the stuff that isn't good/big enough for a real library."
13
13
  s.email = "flori@ping.de"
14
14
  s.extra_rdoc_files = ["README.rdoc", "lib/dslkit.rb", "lib/dslkit/polite.rb", "lib/dslkit/rude.rb", "lib/spruz.rb", "lib/tins.rb", "lib/tins/alias.rb", "lib/tins/annotate.rb", "lib/tins/ask_and_send.rb", "lib/tins/attempt.rb", "lib/tins/bijection.rb", "lib/tins/concern.rb", "lib/tins/count_by.rb", "lib/tins/date_dummy.rb", "lib/tins/date_time_dummy.rb", "lib/tins/deep_const_get.rb", "lib/tins/deep_dup.rb", "lib/tins/dslkit.rb", "lib/tins/extract_last_argument_options.rb", "lib/tins/file_binary.rb", "lib/tins/find.rb", "lib/tins/generator.rb", "lib/tins/go.rb", "lib/tins/hash_symbolize_keys_recursive.rb", "lib/tins/hash_union.rb", "lib/tins/if_predicate.rb", "lib/tins/limited.rb", "lib/tins/lines_file.rb", "lib/tins/memoize.rb", "lib/tins/method_description.rb", "lib/tins/minimize.rb", "lib/tins/module_group.rb", "lib/tins/named_set.rb", "lib/tins/null.rb", "lib/tins/once.rb", "lib/tins/p.rb", "lib/tins/partial_application.rb", "lib/tins/proc_compose.rb", "lib/tins/proc_prelude.rb", "lib/tins/range_plus.rb", "lib/tins/require_maybe.rb", "lib/tins/responding.rb", "lib/tins/rotate.rb", "lib/tins/round.rb", "lib/tins/secure_write.rb", "lib/tins/sexy_singleton.rb", "lib/tins/shuffle.rb", "lib/tins/string_byte_order_mark.rb", "lib/tins/string_camelize.rb", "lib/tins/string_underscore.rb", "lib/tins/string_version.rb", "lib/tins/subhash.rb", "lib/tins/terminal.rb", "lib/tins/thread_local.rb", "lib/tins/time_dummy.rb", "lib/tins/to.rb", "lib/tins/to_proc.rb", "lib/tins/token.rb", "lib/tins/uniq_by.rb", "lib/tins/version.rb", "lib/tins/write.rb", "lib/tins/xt.rb", "lib/tins/xt/annotate.rb", "lib/tins/xt/ask_and_send.rb", "lib/tins/xt/attempt.rb", "lib/tins/xt/blank.rb", "lib/tins/xt/concern.rb", "lib/tins/xt/count_by.rb", "lib/tins/xt/date_dummy.rb", "lib/tins/xt/date_time_dummy.rb", "lib/tins/xt/deep_const_get.rb", "lib/tins/xt/deep_dup.rb", "lib/tins/xt/dslkit.rb", "lib/tins/xt/extract_last_argument_options.rb", "lib/tins/xt/file_binary.rb", "lib/tins/xt/full.rb", "lib/tins/xt/hash_symbolize_keys_recursive.rb", "lib/tins/xt/hash_union.rb", "lib/tins/xt/if_predicate.rb", "lib/tins/xt/irb.rb", "lib/tins/xt/method_description.rb", "lib/tins/xt/named.rb", "lib/tins/xt/null.rb", "lib/tins/xt/p.rb", "lib/tins/xt/partial_application.rb", "lib/tins/xt/proc_compose.rb", "lib/tins/xt/proc_prelude.rb", "lib/tins/xt/range_plus.rb", "lib/tins/xt/require_maybe.rb", "lib/tins/xt/responding.rb", "lib/tins/xt/rotate.rb", "lib/tins/xt/round.rb", "lib/tins/xt/secure_write.rb", "lib/tins/xt/sexy_singleton.rb", "lib/tins/xt/shuffle.rb", "lib/tins/xt/string.rb", "lib/tins/xt/string_byte_order_mark.rb", "lib/tins/xt/string_camelize.rb", "lib/tins/xt/string_underscore.rb", "lib/tins/xt/string_version.rb", "lib/tins/xt/subhash.rb", "lib/tins/xt/symbol_to_proc.rb", "lib/tins/xt/time_dummy.rb", "lib/tins/xt/to.rb", "lib/tins/xt/uniq_by.rb", "lib/tins/xt/write.rb"]
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.rdoc_options = ["--title", "Tins - Useful stuff.", "--main", "README.rdoc"]
19
19
  s.rubygems_version = "2.2.2"
20
20
  s.summary = "Useful stuff."
21
- s.test_files = ["tests/annotate_test.rb", "tests/ask_and_send_test.rb", "tests/attempt_test.rb", "tests/bijection_test.rb", "tests/blank_full_test.rb", "tests/concern_test.rb", "tests/count_by_test.rb", "tests/date_dummy_test.rb", "tests/date_time_dummy_test.rb", "tests/deep_const_get_test.rb", "tests/deep_dup_test.rb", "tests/dslkit_test.rb", "tests/dynamic_scope_test.rb", "tests/extract_last_argument_options_test.rb", "tests/file_binary_test.rb", "tests/find_test.rb", "tests/from_module_test.rb", "tests/generator_test.rb", "tests/go_test.rb", "tests/hash_symbolize_keys_recursive_test.rb", "tests/hash_union_test.rb", "tests/if_predicate_test.rb", "tests/limited_test.rb", "tests/lines_file_test.rb", "tests/memoize_test.rb", "tests/method_description_test.rb", "tests/minimize_test.rb", "tests/module_group_test.rb", "tests/named_set_test.rb", "tests/named_test.rb", "tests/null_test.rb", "tests/p_test.rb", "tests/partial_application_test.rb", "tests/proc_compose_test.rb", "tests/proc_prelude_test.rb", "tests/range_plus_test.rb", "tests/require_maybe_test.rb", "tests/responding_test.rb", "tests/rotate_test.rb", "tests/round_test.rb", "tests/scope_test.rb", "tests/secure_write_test.rb", "tests/sexy_singleton_test.rb", "tests/shuffle_test.rb", "tests/string_byte_order_mark_test.rb", "tests/string_camelize_test.rb", "tests/string_underscore_test.rb", "tests/string_version_test.rb", "tests/subhash_test.rb", "tests/test_helper.rb", "tests/time_dummy_test.rb", "tests/to_test.rb", "tests/token_test.rb", "tests/uniq_by_test.rb", "tests/sexy_singleton_test.rb", "tests/generator_test.rb", "tests/null_test.rb", "tests/find_test.rb", "tests/attempt_test.rb", "tests/proc_prelude_test.rb", "tests/date_time_dummy_test.rb", "tests/range_plus_test.rb", "tests/deep_dup_test.rb", "tests/method_description_test.rb", "tests/bijection_test.rb", "tests/concern_test.rb", "tests/memoize_test.rb", "tests/limited_test.rb", "tests/count_by_test.rb", "tests/blank_full_test.rb", "tests/deep_const_get_test.rb", "tests/file_binary_test.rb", "tests/named_set_test.rb", "tests/if_predicate_test.rb", "tests/p_test.rb", "tests/string_byte_order_mark_test.rb", "tests/annotate_test.rb", "tests/proc_compose_test.rb", "tests/secure_write_test.rb", "tests/string_version_test.rb", "tests/from_module_test.rb", "tests/dynamic_scope_test.rb", "tests/extract_last_argument_options_test.rb", "tests/require_maybe_test.rb", "tests/uniq_by_test.rb", "tests/time_dummy_test.rb", "tests/string_camelize_test.rb", "tests/dslkit_test.rb", "tests/lines_file_test.rb", "tests/string_underscore_test.rb", "tests/date_dummy_test.rb", "tests/hash_symbolize_keys_recursive_test.rb", "tests/named_test.rb", "tests/hash_union_test.rb", "tests/responding_test.rb", "tests/to_test.rb", "tests/go_test.rb", "tests/subhash_test.rb", "tests/partial_application_test.rb", "tests/scope_test.rb", "tests/minimize_test.rb", "tests/round_test.rb", "tests/shuffle_test.rb", "tests/token_test.rb", "tests/ask_and_send_test.rb", "tests/module_group_test.rb", "tests/rotate_test.rb"]
21
+ s.test_files = ["tests/annotate_test.rb", "tests/ask_and_send_test.rb", "tests/attempt_test.rb", "tests/bijection_test.rb", "tests/blank_full_test.rb", "tests/concern_test.rb", "tests/count_by_test.rb", "tests/date_dummy_test.rb", "tests/date_time_dummy_test.rb", "tests/deep_const_get_test.rb", "tests/deep_dup_test.rb", "tests/dslkit_test.rb", "tests/dynamic_scope_test.rb", "tests/extract_last_argument_options_test.rb", "tests/file_binary_test.rb", "tests/find_test.rb", "tests/from_module_test.rb", "tests/generator_test.rb", "tests/go_test.rb", "tests/hash_symbolize_keys_recursive_test.rb", "tests/hash_union_test.rb", "tests/if_predicate_test.rb", "tests/limited_test.rb", "tests/lines_file_test.rb", "tests/memoize_test.rb", "tests/method_description_test.rb", "tests/minimize_test.rb", "tests/module_group_test.rb", "tests/named_set_test.rb", "tests/named_test.rb", "tests/null_test.rb", "tests/p_test.rb", "tests/partial_application_test.rb", "tests/proc_compose_test.rb", "tests/proc_prelude_test.rb", "tests/range_plus_test.rb", "tests/require_maybe_test.rb", "tests/responding_test.rb", "tests/rotate_test.rb", "tests/round_test.rb", "tests/scope_test.rb", "tests/secure_write_test.rb", "tests/sexy_singleton_test.rb", "tests/shuffle_test.rb", "tests/string_byte_order_mark_test.rb", "tests/string_camelize_test.rb", "tests/string_underscore_test.rb", "tests/string_version_test.rb", "tests/subhash_test.rb", "tests/test_helper.rb", "tests/time_dummy_test.rb", "tests/to_test.rb", "tests/token_test.rb", "tests/uniq_by_test.rb", "tests/annotate_test.rb", "tests/ask_and_send_test.rb", "tests/attempt_test.rb", "tests/bijection_test.rb", "tests/blank_full_test.rb", "tests/concern_test.rb", "tests/count_by_test.rb", "tests/date_dummy_test.rb", "tests/date_time_dummy_test.rb", "tests/deep_const_get_test.rb", "tests/deep_dup_test.rb", "tests/dslkit_test.rb", "tests/dynamic_scope_test.rb", "tests/extract_last_argument_options_test.rb", "tests/file_binary_test.rb", "tests/find_test.rb", "tests/from_module_test.rb", "tests/generator_test.rb", "tests/go_test.rb", "tests/hash_symbolize_keys_recursive_test.rb", "tests/hash_union_test.rb", "tests/if_predicate_test.rb", "tests/limited_test.rb", "tests/lines_file_test.rb", "tests/memoize_test.rb", "tests/method_description_test.rb", "tests/minimize_test.rb", "tests/module_group_test.rb", "tests/named_set_test.rb", "tests/named_test.rb", "tests/null_test.rb", "tests/p_test.rb", "tests/partial_application_test.rb", "tests/proc_compose_test.rb", "tests/proc_prelude_test.rb", "tests/range_plus_test.rb", "tests/require_maybe_test.rb", "tests/responding_test.rb", "tests/rotate_test.rb", "tests/round_test.rb", "tests/scope_test.rb", "tests/secure_write_test.rb", "tests/sexy_singleton_test.rb", "tests/shuffle_test.rb", "tests/string_byte_order_mark_test.rb", "tests/string_camelize_test.rb", "tests/string_underscore_test.rb", "tests/string_version_test.rb", "tests/subhash_test.rb", "tests/time_dummy_test.rb", "tests/to_test.rb", "tests/token_test.rb", "tests/uniq_by_test.rb"]
22
22
 
23
23
  if s.respond_to? :specification_version then
24
24
  s.specification_version = 4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-07 00:00:00.000000000 Z
11
+ date: 2014-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar