lono 6.1.1 → 6.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1049f96324d90de9b82a5708712e7ca895b739a6abbb5c6c3d1e2fd83352874b
4
- data.tar.gz: 19dd1187fc592d79a1145d97dd37156ebb4eae79c1d69e625ecb52fee1cd4952
3
+ metadata.gz: afe49322e5d7821b70af120cb40bcac86c069124cb9d376bb4589eba6cee3dc8
4
+ data.tar.gz: 474b9a5234e7a5ea332f5b764281189be497f94f4cf2b667e160dfd858d731d2
5
5
  SHA512:
6
- metadata.gz: 594467392c1552d378e205bf5c19382a99b04bf6ff3ee34fb8fa99851185cea408cd81691e52e7bc204a4df38e7919cc4fd141b409c9bb36f9eb292f8d9fe0e2
7
- data.tar.gz: 3d2e5dbb7a5fe708001f69c65bcf5fb941594688d58fef6a50bfdd03c4da5e01e2615230a2807a417abf1a7f5c7f982acf25b0e861cbfbdcde15e87834853e88
6
+ metadata.gz: 2733f0680a4fee30a18f022733352953433840904b46c394eb18af312704b272462d82ad3d37e8570c5f778b12f848631cd6a9bca7b51a2b8b4ac80cbbbb268e
7
+ data.tar.gz: 5437718228848a4f27d951ca04a0bf84618d14b5c8e542f425d1caea2d57c2197dde9a05ffd7f8d7214c0d4f523a5fa416d7b9a57816cc1e184acce204d561f2
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [6.1.2]
7
+ - #20 improve param Conditional form with 3rd form
8
+
6
9
  ## [6.1.1]
7
10
  - #19 fix param Conditional option
8
11
 
@@ -3,7 +3,8 @@ module Lono::Template::Dsl::Builder::Helpers
3
3
  module ParamHelper
4
4
  # Decorate the parameter method to make smarter.
5
5
  def parameter(*definition)
6
- name, second, _ = definition
6
+ name, second, third = definition
7
+ create_condition = true
7
8
  # medium form
8
9
  if definition.size == 2 && second.is_a?(Hash) && second[:Conditional]
9
10
  # Creates:
@@ -13,10 +14,16 @@ module Lono::Template::Dsl::Builder::Helpers
13
14
  #
14
15
  options = normalize_conditional_parameter_options(second)
15
16
  super(name, options)
16
- condition("Has#{name}", not!(equals(ref(name), "")))
17
+ elsif definition.size == 3 && !second.is_a?(Hash) && third.is_a?(Hash)
18
+ options = normalize_conditional_parameter_options(third)
19
+ options[:Default] = second # probably a String, Integer, or Float
20
+ super(name, options)
17
21
  else
18
22
  super
23
+ create_condition = false
19
24
  end
25
+
26
+ condition("Has#{name}", not!(equals(ref(name), ""))) if create_condition
20
27
  end
21
28
 
22
29
  # use long name to minimize method name collision
@@ -24,7 +31,7 @@ module Lono::Template::Dsl::Builder::Helpers
24
31
  if options.is_a?(Hash)
25
32
  options.delete(:Conditional)
26
33
  options = if options.empty?
27
- ""
34
+ { Default: "" }
28
35
  else
29
36
  defaults = { Default: "" }
30
37
  options.reverse_merge(defaults)
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "6.1.1"
2
+ VERSION = "6.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lono
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.1
4
+ version: 6.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen