supports_pointer 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/supports_pointer/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87a065ab05683ee49c256c0c8e40fd7941cdbd62ff3002e081b5079084da3f85
|
4
|
+
data.tar.gz: b56a1afdc0bbf48c93a38740be725948cc2f2993c59c22795dbbcb059f1719ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 193750b10c644a80c2270d370c87f9fa7cdacec60b42ed64d2bbc8c3346c38483539115885f53931f934eab744d650e033752e93cfdac376bfda2f3518c77112
|
7
|
+
data.tar.gz: '049f9f2140fab34d22b4d92986768f89bdf015909ab6a77cf69ac68ef93d79da1dea0ac6a1f44598e7dccfd6478de92c6d5f9cd0cc0a92f6c7dd807a4f6352f5'
|
data/README.md
CHANGED
@@ -6,8 +6,8 @@ Add the following to your model:
|
|
6
6
|
```ruby
|
7
7
|
parses_pointer :pointer_name_as_symbol,
|
8
8
|
template:/regexp(?<with_captures>.*)for(?<each_field>)/,
|
9
|
-
resolve:{|data| data[:with_captures].find_by(some_param:data[:other_capture]),
|
10
|
-
generate:{|target| "#{target.some_attr}:#{target.other_attr}"}
|
9
|
+
resolve:Proc.new{|data| data[:with_captures].find_by(some_param:data[:other_capture]),
|
10
|
+
generate:Proc.new{|target| "#{target.some_attr}:#{target.other_attr}"}
|
11
11
|
```
|
12
12
|
|
13
13
|
if the pointer being declared is a model pointer, or model_instance pointer, simply declare:
|
@@ -50,7 +50,7 @@ This will allow the Widget class to access the handle pointer.
|
|
50
50
|
|
51
51
|
A pointer can be parsed by calling ```parse_pointer``` on any model or object
|
52
52
|
which supports the pointer type in question. In situations where a string matches
|
53
|
-
the regexp of multiple pointer types, you can specify the pointer_type used for parsing with ```parse_{
|
53
|
+
the regexp of multiple pointer types, you can specify the pointer_type used for parsing with ```parse_{pointer_type_name}_pointer``` such as ```parse_model_pointer``` or ```parse_model_instance_pointer```.
|
54
54
|
|
55
55
|
When declaring model & model instance pointers, it may be helpful to declare a ```to_pointer``` method, returning ```generate_model_pointer``` and ```generate_model_instance_pointer```
|
56
56
|
respectively:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: supports_pointer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Mikeska
|
@@ -55,6 +55,7 @@ licenses:
|
|
55
55
|
metadata:
|
56
56
|
homepage_uri: https://github.com/gmikeska/supports_pointer
|
57
57
|
source_code_uri: https://github.com/gmikeska/supports_pointer
|
58
|
+
documentation_uri: https://www.rubydoc.info/gems/supports_pointer
|
58
59
|
changelog_uri: https://github.com/gmikeska/supports_pointer/blob/master/CHANGELOG.MD
|
59
60
|
post_install_message:
|
60
61
|
rdoc_options: []
|