inline_transforms 0.1.0 → 0.2.0

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,78 @@
1
+ <!DOCTYPE html>
2
+ <html >
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
+ <meta charset="utf-8">
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen">
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen">
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <title>Method List</title>
19
+ <base id="base_target" target="_parent">
20
+ </head>
21
+ <body>
22
+ <div id="content">
23
+ <div class="fixed_header">
24
+ <h1 id="full_list_header">Method List</h1>
25
+ <div id="full_list_nav">
26
+
27
+ <span><a target="_self" href="class_list.html">
28
+ Classes
29
+ </a></span>
30
+
31
+ <span><a target="_self" href="method_list.html">
32
+ Methods
33
+ </a></span>
34
+
35
+ <span><a target="_self" href="file_list.html">
36
+ Files
37
+ </a></span>
38
+
39
+ </div>
40
+
41
+ <div id="search">
42
+ <label for="search-class">Search:</label>
43
+ <input id="search-class" type="text">
44
+ </div>
45
+ </div>
46
+
47
+ <ul id="full_list" class="method">
48
+
49
+
50
+ <li class="odd ">
51
+ <div class="item">
52
+ <span class='object_link'><a href="InlineTransforms.html#only_if-instance_method" title="InlineTransforms#only_if (method)">#only_if</a></span>
53
+ <small>InlineTransforms</small>
54
+ </div>
55
+ </li>
56
+
57
+
58
+ <li class="even ">
59
+ <div class="item">
60
+ <span class='object_link'><a href="InlineTransforms.html#transform-instance_method" title="InlineTransforms#transform (method)">#transform</a></span>
61
+ <small>InlineTransforms</small>
62
+ </div>
63
+ </li>
64
+
65
+
66
+ <li class="odd ">
67
+ <div class="item">
68
+ <span class='object_link'><a href="InlineTransforms.html#unless-instance_method" title="InlineTransforms#unless (method)">#unless</a></span>
69
+ <small>InlineTransforms</small>
70
+ </div>
71
+ </li>
72
+
73
+
74
+
75
+ </ul>
76
+ </div>
77
+ </body>
78
+ </html>
@@ -0,0 +1,114 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Top Level Namespace
8
+
9
+ &mdash; Documentation by YARD 0.9.45
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css">
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css">
16
+
17
+ <script type="text/javascript">
18
+ pathId = "";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div id="main_progress" aria-hidden="true"></div>
31
+
32
+ <div class="nav_wrap">
33
+ <iframe id="nav" src="class_list.html?1"></iframe>
34
+ <div id="resizer"></div>
35
+ </div>
36
+
37
+ <div id="main" tabindex="-1">
38
+ <div id="header">
39
+ <div id="menu">
40
+
41
+ <a href="_index.html">Index</a> &raquo;
42
+
43
+
44
+ <span class="title">Top Level Namespace</span>
45
+
46
+ </div>
47
+
48
+ <div id="search">
49
+
50
+ <a class="full_list_link" id="class_list_link"
51
+ href="class_list.html">
52
+
53
+ <svg width="24" height="24">
54
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
55
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
56
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
57
+ </svg>
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <div id="content"><h1>Top Level Namespace
65
+
66
+
67
+
68
+ </h1>
69
+ <div class="box_info">
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ </div>
82
+
83
+ <h2>Defined Under Namespace</h2>
84
+ <p class="children">
85
+
86
+
87
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="InlineTransforms.html" title="InlineTransforms (module)">InlineTransforms</a></span>
88
+
89
+
90
+
91
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span>
92
+
93
+
94
+ </p>
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ </div>
105
+
106
+ <div id="footer">
107
+ Generated on Tue Aug 25 16:11:47 2026 by
108
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
109
+ 0.9.45 (ruby-3.4.8).
110
+ </div>
111
+
112
+ </div>
113
+ </body>
114
+ </html>
@@ -1,3 +1,3 @@
1
1
  module InlineTransforms
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require_relative 'inline_transforms/version'
2
2
 
3
- # Defines `unless` and `transform`, which we'll then want to make available in `Object` instances.
3
+ # Defines `only_if`, `unless`, and `transform`, which we'll then want to make available in `Object` instances.
4
4
  #
5
5
  module InlineTransforms
6
6
  # Our use of case equality in matching bad/target values
@@ -8,6 +8,30 @@ module InlineTransforms
8
8
  #
9
9
  # rubocop:disable Style/CaseEquality
10
10
 
11
+ # Returns `self` _only if_ it matches a "good" value; otherwise returns an alternate (`else:`) value.
12
+ #
13
+ # (NOTE: this takes an `else: nil` named param, but is defined as taking `(**options)` because `else` is reserved.)
14
+ #
15
+ #
16
+ # @param good_value [Object]
17
+ # The one value we consider "good", and for which we'd like `self` returned.
18
+ #
19
+ # @option else: [Object]
20
+ # The value we'd like back if `self` does not match the `good_value` **using case comparison**.
21
+ # Defaults to `nil`.
22
+ #
23
+ # @return
24
+ # Returns either `self` or the value given as the `else:` option.
25
+ #
26
+ def only_if(good_value, **options)
27
+ return self if inline_transforms_equality? good_value
28
+
29
+ alt_value = options[:else]
30
+ return alt_value.call if alt_value.is_a? Proc
31
+
32
+ alt_value
33
+ end
34
+
11
35
  # Returns `self` ... unless it matches a "bad" value, in which case it returns an alternate (`then:`) value.
12
36
  #
13
37
  # (NOTE: this takes a `then: nil` named param, but is defined as taking `(**options)` because `then` is reserved.)
@@ -42,7 +66,7 @@ module InlineTransforms
42
66
  # A hash of keys to case-compare against `self` so we can return the corresponding value.
43
67
  #
44
68
  # @option else: [Object]
45
- # The fallback value to return if no matching key is found.
69
+ # The fallback value to return if no matching key is found. Defaults to `nil`.
46
70
  #
47
71
  # @return
48
72
  # Returns either `self`, one of the transformation hash values, or the `else:` option.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_transforms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nestor Custodio
@@ -20,6 +20,22 @@ files:
20
20
  - LICENSE
21
21
  - README.md
22
22
  - Rakefile
23
+ - docs/InlineTransforms.html
24
+ - docs/Object.html
25
+ - docs/_index.html
26
+ - docs/class_list.html
27
+ - docs/css/common.css
28
+ - docs/css/full_list.css
29
+ - docs/css/style.css
30
+ - docs/file.README.html
31
+ - docs/file_list.html
32
+ - docs/frames.html
33
+ - docs/index.html
34
+ - docs/js/app.js
35
+ - docs/js/full_list.js
36
+ - docs/js/jquery.js
37
+ - docs/method_list.html
38
+ - docs/top-level-namespace.html
23
39
  - lib/inline_transforms.rb
24
40
  - lib/inline_transforms/version.rb
25
41
  homepage: https://github.com/nestor-custodio/inline_transforms