motion-support 1.1.0 → 1.1.1

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.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +4 -1
  3. data/Gemfile +0 -2
  4. data/Rakefile +3 -3
  5. data/lib/motion-support.rb +7 -2
  6. data/lib/motion-support/callbacks.rb +4 -11
  7. data/lib/motion-support/concern.rb +4 -7
  8. data/lib/motion-support/core_ext.rb +3 -2
  9. data/lib/motion-support/core_ext/array.rb +4 -13
  10. data/lib/motion-support/core_ext/class.rb +4 -8
  11. data/lib/motion-support/core_ext/core_ext_files.rb +128 -0
  12. data/lib/motion-support/core_ext/hash.rb +4 -17
  13. data/lib/motion-support/core_ext/integer.rb +4 -9
  14. data/lib/motion-support/core_ext/module.rb +4 -14
  15. data/lib/motion-support/core_ext/numeric.rb +4 -9
  16. data/lib/motion-support/core_ext/object.rb +4 -15
  17. data/lib/motion-support/core_ext/range.rb +4 -8
  18. data/lib/motion-support/core_ext/string.rb +4 -17
  19. data/lib/motion-support/core_ext/time.rb +4 -19
  20. data/lib/motion-support/inflector.rb +4 -12
  21. data/lib/motion-support/motion_support_files.rb +62 -0
  22. data/motion-support.gemspec +0 -1
  23. data/motion/callbacks.rb +0 -2
  24. data/motion/core_ext/date/acts_like.rb +0 -2
  25. data/motion/core_ext/date/calculations.rb +1 -3
  26. data/motion/core_ext/hash/keys.rb +23 -0
  27. data/motion/core_ext/ns_dictionary.rb +0 -2
  28. data/motion/core_ext/ns_string.rb +0 -2
  29. data/motion/core_ext/object/to_param.rb +0 -23
  30. data/motion/core_ext/object/to_query.rb +0 -5
  31. data/motion/core_ext/range/include_range.rb +0 -2
  32. data/motion/core_ext/time/acts_like.rb +0 -2
  33. data/motion/core_ext/time/calculations.rb +0 -2
  34. data/motion/hash_with_indifferent_access.rb +0 -2
  35. data/motion/inflections.rb +0 -2
  36. data/motion/inflector/inflections.rb +0 -2
  37. data/motion/version.rb +1 -1
  38. data/spec/motion-support/core_ext/date/calculation_spec.rb +8 -0
  39. data/spec/motion-support/core_ext/object/duplicable_spec.rb +1 -1
  40. data/spec/motion-support/descendants_tracker_spec.rb +1 -1
  41. metadata +5 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 92aedb6bf610b18c1dc1cdcdb855e66e45609c53
4
- data.tar.gz: d23e118722a4ab7ef6ae56629e51fe7593f5960f
2
+ SHA256:
3
+ metadata.gz: fb1ff177f4b84a6fc23392f73aa8ceb58eb58a1d6da30660153c004070e42ea7
4
+ data.tar.gz: 371dcdea83efd1048663c65cd230be45866b2ead4367c0189c2bb69b5c117fed
5
5
  SHA512:
6
- metadata.gz: 6ef05d091c1d0037e3b42c4f458e6a39c6bc4b2d8d4a15d7d5ffd34638b39796ca84813f488c27ed4eb42525b9c5be16216e127c418f9df8c6f989872f132b91
7
- data.tar.gz: 45ae5cba23a54f5adec630e5540db9271381cdd2c964f788282538e56072ec817552ba45ffffbe87b077db3c8b50772bf45d165c53f41c092a69f82c45a8c1ed
6
+ metadata.gz: 93871463c660f5b74856a029910f0941f29cac1b754be1c1d56a6a45d2e58611f490f20c2d485c521c72c9843efd9e69e9d03582b8d77f02596e87a31eaf85d9
7
+ data.tar.gz: 932befa36000e9ea2d5bbcc159606e3d3c228707ba0d028ad52b5a586b44e0ec579b1e1997e86811f14153a44569358de3b6c7895446f87a938f0d0e1fe3abf3
data/.travis.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  language: objective-c
2
- osx_image: xcode7.1
2
+ osx_image: xcode8
3
+ before_install:
4
+ - sudo motion update
5
+ - motion repo
3
6
  script: bundle exec rake spec
4
7
  deploy:
5
8
  provider: rubygems
data/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'motion-require'
4
-
5
3
  # Specify your gem's dependencies in motion-support.gemspec
6
4
  gemspec
data/Rakefile CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env rake
2
2
  $:.unshift("/Library/RubyMotion/lib")
3
+ $:.unshift("~/.rubymotion/rubymotion-templates")
3
4
  require 'motion/project/template/ios'
4
- require "bundler/gem_tasks"
5
- Bundler.setup
5
+ require 'bundler/setup'
6
+ require 'motion/project/template/gem/gem_tasks'
6
7
  Bundler.require
7
8
 
8
9
  require 'motion-support'
@@ -10,5 +11,4 @@ require 'motion-support'
10
11
  Motion::Project::App.setup do |app|
11
12
  # Use `rake config' to see complete project settings.
12
13
  app.name = 'MotionSupport'
13
- app.detect_dependencies = false
14
14
  end
@@ -1,3 +1,8 @@
1
- require 'motion-require'
1
+ unless defined?(Motion::Project::Config)
2
+ raise "This file must be required within a RubyMotion project Rakefile."
3
+ end
2
4
 
3
- Motion::Require.all(Dir.glob(File.expand_path('../../motion/**/*.rb', __FILE__)))
5
+ require 'motion-support/motion_support_files'
6
+ Motion::Project::App.setup do |app|
7
+ app.files.unshift(MotionSupport.requires)
8
+ end
@@ -1,11 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- "_stdlib/array",
5
- "concern",
6
- "descendants_tracker",
7
- "callbacks",
8
- "core_ext/kernel/singleton_class"
9
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../motion", "#{file}.rb")) }
10
-
11
- Motion::Require.all(files)
1
+ require_relative 'motion_support_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.callbacks_files)
4
+ end
@@ -1,7 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- "concern"
5
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../motion", "#{file}.rb")) }
6
-
7
- Motion::Require.all(files)
1
+ require_relative 'motion_support_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.concern_files)
4
+ end
@@ -1,3 +1,4 @@
1
- Dir["#{File.dirname(__FILE__)}/core_ext/*.rb"].sort.each do |path|
2
- require path
1
+ require_relative 'motion_support_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.core_ext_files)
3
4
  end
@@ -1,13 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- 'core_ext/array',
5
- 'core_ext/array/wrap',
6
- 'core_ext/array/access',
7
- 'core_ext/array/conversions',
8
- 'core_ext/array/extract_options',
9
- 'core_ext/array/grouping',
10
- 'core_ext/array/prepend_and_append'
11
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb")) }
12
-
13
- Motion::Require.all(files)
1
+ require_relative 'core_ext_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.array_files)
4
+ end
@@ -1,8 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- 'core_ext/class/attribute',
5
- 'core_ext/class/attribute_accessors',
6
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb")) }
7
-
8
- Motion::Require.all(files)
1
+ require_relative 'core_ext_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.class_files)
4
+ end
@@ -0,0 +1,128 @@
1
+ module MotionSupport
2
+ class << self
3
+ def array_files
4
+ %w(
5
+ core_ext/array
6
+ core_ext/array/wrap
7
+ core_ext/array/access
8
+ core_ext/array/conversions
9
+ core_ext/array/extract_options
10
+ core_ext/array/grouping
11
+ core_ext/array/prepend_and_append
12
+ ).map { |file| self.map_core_ext_file_to_motion_dir(file) }
13
+ end
14
+
15
+ def class_files
16
+ %w(
17
+ core_ext/class/attribute
18
+ core_ext/class/attribute_accessors
19
+ ).map { |file| self.map_core_ext_file_to_motion_dir(file) }
20
+ end
21
+
22
+ def hash_files
23
+ %w(
24
+ core_ext/ns_dictionary
25
+ core_ext/object/to_param
26
+ core_ext/hash/deep_merge
27
+ core_ext/hash/except
28
+ core_ext/hash/indifferent_access
29
+ core_ext/hash/keys
30
+ core_ext/hash/reverse_merge
31
+ core_ext/hash/slice
32
+ core_ext/hash/deep_delete_if
33
+ hash_with_indifferent_access
34
+ core_ext/module/delegation
35
+ ).map { |file| self.map_core_ext_file_to_motion_dir(file) }
36
+ end
37
+
38
+ def integer_files
39
+ %w(
40
+ core_ext/integer/multiple
41
+ core_ext/integer/inflections
42
+ core_ext/integer/time
43
+ ).map { |file| self.map_core_ext_file_to_motion_dir(file) }
44
+ end
45
+
46
+ def module_files
47
+ %w(
48
+ core_ext/module/aliasing
49
+ core_ext/module/introspection
50
+ core_ext/module/anonymous
51
+ core_ext/module/reachable
52
+ core_ext/module/attribute_accessors
53
+ core_ext/module/attr_internal
54
+ core_ext/module/delegation
55
+ core_ext/module/remove_method
56
+ ).map { |file| self.map_core_ext_file_to_motion_dir(file) }
57
+ end
58
+
59
+ def numeric_files
60
+ %w(
61
+ duration
62
+ core_ext/numeric/bytes
63
+ core_ext/numeric/conversions
64
+ core_ext/numeric/time
65
+ ).map { |file| self.map_core_ext_file_to_motion_dir(file) }
66
+ end
67
+
68
+ def object_files
69
+ %w(
70
+ _stdlib/cgi
71
+ core_ext/object/acts_like
72
+ core_ext/object/blank
73
+ core_ext/object/deep_dup
74
+ core_ext/object/duplicable
75
+ core_ext/object/inclusion
76
+ core_ext/object/try
77
+ core_ext/object/instance_variables
78
+ core_ext/object/to_json
79
+ core_ext/object/to_param
80
+ core_ext/object/to_query
81
+ ).map { |file| self.map_core_ext_file_to_motion_dir(file) }
82
+ end
83
+
84
+ def range_files
85
+ %w(
86
+ core_ext/range/include_range
87
+ core_ext/range/overlaps
88
+ ).map { |file| self.map_core_ext_file_to_motion_dir(file) }
89
+ end
90
+
91
+ def string_files
92
+ %w(
93
+ core_ext/ns_string
94
+ core_ext/string/access
95
+ core_ext/string/behavior
96
+ core_ext/string/exclude
97
+ core_ext/string/filters
98
+ core_ext/string/indent
99
+ core_ext/string/starts_ends_with
100
+ core_ext/string/inflections
101
+ core_ext/string/strip
102
+ core_ext/module/delegation
103
+ ).map { |file| self.map_core_ext_file_to_motion_dir(file) }
104
+ end
105
+
106
+ def time_files
107
+ %w(
108
+ _stdlib/date
109
+ _stdlib/time
110
+ core_ext/time/acts_like
111
+ core_ext/time/calculations
112
+ core_ext/time/conversions
113
+ core_ext/date/acts_like
114
+ core_ext/date/calculations
115
+ core_ext/date/conversions
116
+ core_ext/date_and_time/calculations
117
+ core_ext/integer/time
118
+ core_ext/numeric/time
119
+ core_ext/object/acts_like
120
+ duration
121
+ ).map { |file| self.map_core_ext_file_to_motion_dir(file) }
122
+ end
123
+
124
+ def map_core_ext_file_to_motion_dir(file)
125
+ File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb"))
126
+ end
127
+ end
128
+ end
@@ -1,17 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- 'core_ext/ns_dictionary',
5
- 'core_ext/hash/deep_merge',
6
- 'core_ext/hash/except',
7
- 'core_ext/hash/indifferent_access',
8
- 'core_ext/hash/keys',
9
- 'core_ext/hash/reverse_merge',
10
- 'core_ext/hash/slice',
11
- 'core_ext/hash/deep_delete_if',
12
- 'hash_with_indifferent_access',
13
-
14
- 'core_ext/module/delegation'
15
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb")) }
16
-
17
- Motion::Require.all(files)
1
+ require_relative 'core_ext_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.hash_files)
4
+ end
@@ -1,9 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- 'core_ext/integer/multiple',
5
- 'core_ext/integer/inflections',
6
- 'core_ext/integer/time'
7
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb")) }
8
-
9
- Motion::Require.all(files)
1
+ require_relative 'core_ext_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.integer_files)
4
+ end
@@ -1,14 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- 'core_ext/module/aliasing',
5
- 'core_ext/module/introspection',
6
- 'core_ext/module/anonymous',
7
- 'core_ext/module/reachable',
8
- 'core_ext/module/attribute_accessors',
9
- 'core_ext/module/attr_internal',
10
- 'core_ext/module/delegation',
11
- 'core_ext/module/remove_method'
12
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb")) }
13
-
14
- Motion::Require.all(files)
1
+ require_relative 'core_ext_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.module_files)
4
+ end
@@ -1,9 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- 'core_ext/numeric/bytes',
5
- 'core_ext/numeric/conversions',
6
- 'core_ext/numeric/time'
7
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb")) }
8
-
9
- Motion::Require.all(files)
1
+ require_relative 'core_ext_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.numeric_files)
4
+ end
@@ -1,15 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- '_stdlib/cgi',
5
- 'core_ext/object/acts_like',
6
- 'core_ext/object/blank',
7
- 'core_ext/object/deep_dup',
8
- 'core_ext/object/duplicable',
9
- 'core_ext/object/try',
10
- 'core_ext/object/instance_variables',
11
- 'core_ext/object/to_param',
12
- 'core_ext/object/to_query',
13
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb")) }
14
-
15
- Motion::Require.all(files)
1
+ require_relative 'core_ext_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.object_files)
4
+ end
@@ -1,8 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- 'core_ext/range/include_range',
5
- 'core_ext/range/overlaps'
6
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb")) }
7
-
8
- Motion::Require.all(files)
1
+ require_relative 'core_ext_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.range_files)
4
+ end
@@ -1,17 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- 'core_ext/ns_string',
5
- 'core_ext/string/access',
6
- 'core_ext/string/behavior',
7
- 'core_ext/string/exclude',
8
- 'core_ext/string/filters',
9
- 'core_ext/string/indent',
10
- 'core_ext/string/starts_ends_with',
11
- 'core_ext/string/inflections',
12
- 'core_ext/string/strip',
13
-
14
- 'core_ext/module/delegation'
15
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb")) }
16
-
17
- Motion::Require.all(files)
1
+ require_relative 'core_ext_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.string_files)
4
+ end
@@ -1,19 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- '_stdlib/date',
5
- '_stdlib/time',
6
- 'core_ext/time/acts_like',
7
- 'core_ext/time/calculations',
8
- 'core_ext/time/conversions',
9
- 'core_ext/date/acts_like',
10
- 'core_ext/date/calculations',
11
- 'core_ext/date/conversions',
12
- 'core_ext/date_and_time/calculations',
13
- 'core_ext/integer/time',
14
- 'core_ext/numeric/time',
15
- 'core_ext/object/acts_like',
16
- 'duration'
17
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../../motion", "#{file}.rb")) }
18
-
19
- Motion::Require.all(files)
1
+ require_relative 'core_ext_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.time_files)
4
+ end
@@ -1,12 +1,4 @@
1
- require 'motion-require'
2
-
3
- files = [
4
- "inflector/inflections",
5
- "inflector/methods",
6
- "inflections",
7
- "core_ext/string/inflections",
8
-
9
- "core_ext/array/prepend_and_append"
10
- ].map { |file| File.expand_path(File.join(File.dirname(__FILE__), "/../../motion", "#{file}.rb")) }
11
-
12
- Motion::Require.all(files)
1
+ require_relative 'motion_support_files'
2
+ Motion::Project::App.setup do |app|
3
+ app.files.unshift(MotionSupport.inflector_files)
4
+ end
@@ -0,0 +1,62 @@
1
+ require_relative 'core_ext/core_ext_files'
2
+ module MotionSupport
3
+ class << self
4
+
5
+ def callbacks_files
6
+ %w(
7
+ _stdlib/array
8
+ concern
9
+ descendants_tracker
10
+ callbacks
11
+ core_ext/kernel/singleton_class
12
+ ).map { |file| self.map_file_to_motion_dir(file) }
13
+ end
14
+
15
+ def concern_files
16
+ ['concern'].map { |file| self.map_file_to_motion_dir(file) }
17
+ end
18
+
19
+ def core_ext_files
20
+ base_files = %w(
21
+ core_ext/enumerable
22
+ core_ext/array
23
+ core_ext/metaclass
24
+ core_ext/ns_dictionary
25
+ core_ext/ns_string
26
+ core_ext/regexp
27
+ ).map { |file| self.map_file_to_motion_dir(file) }
28
+
29
+ (array_files + class_files + module_files + integer_files + hash_files +
30
+ numeric_files + object_files + range_files + string_files + time_files + base_files).uniq
31
+ end
32
+
33
+ def inflector_files
34
+ %w(
35
+ inflector/inflections
36
+ inflector/methods
37
+ inflections
38
+ core_ext/string/inflections
39
+ core_ext/array/prepend_and_append
40
+ ).map { |file| self.map_file_to_motion_dir(file) }
41
+ end
42
+
43
+ def requires
44
+ base_files = %w(
45
+ callbacks
46
+ concern
47
+ descendants_tracker
48
+ duration
49
+ hash_with_indifferent_access
50
+ inflections
51
+ logger
52
+ number_helper
53
+ version
54
+ ).map { |file| self.map_file_to_motion_dir(file) }
55
+ (callbacks_files + core_ext_files + inflector_files + base_files).uniq
56
+ end
57
+
58
+ def map_file_to_motion_dir(file)
59
+ File.expand_path(File.join(File.dirname(__FILE__), "/../../motion", "#{file}.rb"))
60
+ end
61
+ end
62
+ end
@@ -15,6 +15,5 @@ Gem::Specification.new do |s|
15
15
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
16
  s.require_paths = ["lib"]
17
17
 
18
- s.add_dependency "motion-require", ">= 0.0.6"
19
18
  s.add_development_dependency 'rake'
20
19
  end
data/motion/callbacks.rb CHANGED
@@ -1,5 +1,3 @@
1
- motion_require 'concern'
2
-
3
1
  module MotionSupport
4
2
  # Callbacks are code hooks that are run at key points in an object's lifecycle.
5
3
  # The typical use case is to have a base class define a set of callbacks
@@ -1,5 +1,3 @@
1
- motion_require '../object/acts_like'
2
-
3
1
  class Date
4
2
  # Duck-types as a Date-like class. See Object#acts_like?.
5
3
  def acts_like_date?
@@ -1,5 +1,3 @@
1
- motion_require "../date_and_time/calculations"
2
-
3
1
  class Date
4
2
  include DateAndTime::Calculations
5
3
 
@@ -79,7 +77,7 @@ class Date
79
77
  end
80
78
  alias_method :plus_without_duration, :+
81
79
  alias_method :+, :plus_with_duration
82
-
80
+
83
81
  def minus_with_duration(other) #:nodoc:
84
82
  if MotionSupport::Duration === other
85
83
  plus_with_duration(-other)
@@ -147,4 +147,27 @@ class Hash
147
147
  def deep_symbolize_keys!
148
148
  deep_transform_keys!{ |key| key.to_sym rescue key }
149
149
  end
150
+
151
+ # Returns a string representation of the receiver suitable for use as a URL
152
+ # query string:
153
+ #
154
+ # {name: 'David', nationality: 'Danish'}.to_param
155
+ # # => "name=David&nationality=Danish"
156
+ #
157
+ # An optional namespace can be passed to enclose the param names:
158
+ #
159
+ # {name: 'David', nationality: 'Danish'}.to_param('user')
160
+ # # => "user[name]=David&user[nationality]=Danish"
161
+ #
162
+ # The string pairs "key=value" that conform the query string
163
+ # are sorted lexicographically in ascending order.
164
+ #
165
+ # This method is also aliased as +to_query+.
166
+ def to_param(namespace = nil)
167
+ collect do |key, value|
168
+ value.to_query(namespace ? "#{namespace}[#{key}]" : key)
169
+ end.sort * '&'
170
+ end
171
+ alias_method :to_query, :to_param
172
+
150
173
  end
@@ -1,5 +1,3 @@
1
- motion_require "module/delegation"
2
-
3
1
  class NSDictionary
4
2
  def to_hash
5
3
  Hash.new.tap do |h|
@@ -1,5 +1,3 @@
1
- motion_require "module/delegation"
2
-
3
1
  class NSString
4
2
  def to_s
5
3
  String.new(self)
@@ -33,26 +33,3 @@ class Array
33
33
  collect { |e| e.to_param }.join '/'
34
34
  end
35
35
  end
36
-
37
- class Hash
38
- # Returns a string representation of the receiver suitable for use as a URL
39
- # query string:
40
- #
41
- # {name: 'David', nationality: 'Danish'}.to_param
42
- # # => "name=David&nationality=Danish"
43
- #
44
- # An optional namespace can be passed to enclose the param names:
45
- #
46
- # {name: 'David', nationality: 'Danish'}.to_param('user')
47
- # # => "user[name]=David&user[nationality]=Danish"
48
- #
49
- # The string pairs "key=value" that conform the query string
50
- # are sorted lexicographically in ascending order.
51
- #
52
- # This method is also aliased as +to_query+.
53
- def to_param(namespace = nil)
54
- collect do |key, value|
55
- value.to_query(namespace ? "#{namespace}[#{key}]" : key)
56
- end.sort * '&'
57
- end
58
- end
@@ -1,5 +1,3 @@
1
- motion_require 'to_param'
2
-
3
1
  class Object
4
2
  # Converts an object into a string suitable for use as a URL query string, using the given <tt>key</tt> as the
5
3
  # param name.
@@ -21,6 +19,3 @@ class Array
21
19
  end
22
20
  end
23
21
 
24
- class Hash
25
- alias_method :to_query, :to_param
26
- end
@@ -1,5 +1,3 @@
1
- motion_require "../module/aliasing"
2
-
3
1
  class Range
4
2
  # Extends the default Range#include? to support range comparisons.
5
3
  # (1..5).include?(1..5) # => true
@@ -1,5 +1,3 @@
1
- motion_require '../object/acts_like'
2
-
3
1
  class Time
4
2
  # Duck-types as a Time-like class. See Object#acts_like?.
5
3
  def acts_like_time?
@@ -1,5 +1,3 @@
1
- motion_require "../date_and_time/calculations"
2
-
3
1
  class Time
4
2
  include DateAndTime::Calculations
5
3
 
@@ -1,5 +1,3 @@
1
- motion_require 'core_ext/hash/keys'
2
-
3
1
  module MotionSupport
4
2
  # Implements a hash where keys <tt>:foo</tt> and <tt>"foo"</tt> are considered
5
3
  # to be the same.
@@ -1,5 +1,3 @@
1
- motion_require 'inflector/inflections'
2
-
3
1
  module MotionSupport
4
2
  Inflector.inflections do |inflect|
5
3
  inflect.plural(/$/, 's')
@@ -1,5 +1,3 @@
1
- motion_require '../core_ext/array/prepend_and_append'
2
-
3
1
  module MotionSupport
4
2
  module Inflector
5
3
  extend self
data/motion/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module MotionSupport
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -182,5 +182,13 @@ describe "Date" do
182
182
  Date.yesterday.should.not.be.future
183
183
  end
184
184
  end
185
+
186
+ describe "plus_with_duration" do
187
+ it "should calculate correctly" do
188
+ (Date.new(1982,10,4) + 1.day).should == Date.new(1982,10,5)
189
+ (Date.new(1982,10,4) + 1.month).should == Date.new(1982,11,4)
190
+ (Date.new(1982,10,4) + 1.year).should == Date.new(1983,10,4)
191
+ end
192
+ end
185
193
  end
186
194
  end
@@ -1,6 +1,6 @@
1
1
  describe "duplicable?" do
2
2
  before do
3
- @raise_dup = [nil, false, true, :symbol, 1, 2.3, 5.seconds, BigDecimal.new('4.56')]
3
+ @raise_dup = [nil, false, true]
4
4
  @yes = ['1', Object.new, /foo/, [], {}, Time.now, Class.new, Module.new]
5
5
  @no = []
6
6
  end
@@ -18,7 +18,7 @@ module DescendantsTrackerSpec
18
18
  ALL = [Parent, Child1, Child2, Grandchild1, Grandchild2]
19
19
  end
20
20
 
21
- describe "DescendatsTracker" do
21
+ describe "DescendantsTracker" do
22
22
  describe "descendants" do
23
23
  it "should get all descendants from parent class" do
24
24
  [DescendantsTrackerSpec::Child1, DescendantsTrackerSpec::Child2, DescendantsTrackerSpec::Grandchild1, DescendantsTrackerSpec::Grandchild2].should == DescendantsTrackerSpec::Parent.descendants
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Kadauke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-11 00:00:00.000000000 Z
11
+ date: 2019-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: motion-require
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 0.0.6
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: 0.0.6
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -70,6 +56,7 @@ files:
70
56
  - lib/motion-support/core_ext.rb
71
57
  - lib/motion-support/core_ext/array.rb
72
58
  - lib/motion-support/core_ext/class.rb
59
+ - lib/motion-support/core_ext/core_ext_files.rb
73
60
  - lib/motion-support/core_ext/hash.rb
74
61
  - lib/motion-support/core_ext/integer.rb
75
62
  - lib/motion-support/core_ext/module.rb
@@ -79,6 +66,7 @@ files:
79
66
  - lib/motion-support/core_ext/string.rb
80
67
  - lib/motion-support/core_ext/time.rb
81
68
  - lib/motion-support/inflector.rb
69
+ - lib/motion-support/motion_support_files.rb
82
70
  - motion-support.gemspec
83
71
  - motion/_stdlib/array.rb
84
72
  - motion/_stdlib/cgi.rb
@@ -248,8 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
236
  - !ruby/object:Gem::Version
249
237
  version: '0'
250
238
  requirements: []
251
- rubyforge_project:
252
- rubygems_version: 2.4.5.1
239
+ rubygems_version: 3.0.6
253
240
  signing_key:
254
241
  specification_version: 4
255
242
  summary: Commonly useful extensions to the standard library for RubyMotion