general 1.4.1 → 1.4.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 +4 -4
- data/lib/gpartials.rb +9 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1009797918440470703fb9df531ce259dc30cd2e
|
4
|
+
data.tar.gz: 258532c1f86afa8ad744b8e57ad1384a0ae440f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 137a5d03956c3a2a315a2bbd0ac5a2c1ea4348a9e8d33d471362c067b7d4fcd39bea4cafadc9cf5820b7257e866d76efc4695063f3bf59dbb1f84b839586ede6
|
7
|
+
data.tar.gz: bb09712f7e313faeb0855c58cda345648942466b8c3a63c5562d81dd1c2f341ae8e3619fddc722ffb9b5f73f89dd3c2084946a861ca0741f4b6b283c851835db
|
data/lib/gpartials.rb
CHANGED
@@ -36,16 +36,12 @@ module General
|
|
36
36
|
# Returns the string
|
37
37
|
#
|
38
38
|
# Returns: the string
|
39
|
-
def apply
|
40
|
-
@string
|
41
|
-
end
|
39
|
+
def apply(data); @string; end
|
42
40
|
|
43
41
|
# Returns the string
|
44
42
|
#
|
45
43
|
# Returns: the string
|
46
|
-
def to_s
|
47
|
-
@string
|
48
|
-
end
|
44
|
+
def to_s; @string; end
|
49
45
|
end
|
50
46
|
|
51
47
|
# Represents a placeholder partial in a GTemplate
|
@@ -88,7 +84,10 @@ module General
|
|
88
84
|
#
|
89
85
|
# Return: the string representation of the placeholder
|
90
86
|
def to_s
|
91
|
-
|
87
|
+
str = "@(#{@name}"
|
88
|
+
str += ": #{@defaults[@name]}" if @defaults[@name]
|
89
|
+
str += "-> #{@operation}" if @operation
|
90
|
+
return str + ")"
|
92
91
|
end
|
93
92
|
end
|
94
93
|
|
@@ -122,16 +121,12 @@ module General
|
|
122
121
|
#
|
123
122
|
# Return: the value of the array placeholder in the given data
|
124
123
|
# formatted by the given GTemplate and joined by the given delimeter
|
125
|
-
def apply data
|
126
|
-
return @template.apply_all(data[@name]).join(@delimeter)
|
127
|
-
end
|
124
|
+
def apply(data); @template.apply_all(data[@name]).join(@delimeter); end
|
128
125
|
|
129
126
|
# Returns the string representation of the array placeholder
|
130
127
|
#
|
131
128
|
# Return: the string representation of the array placeholder
|
132
|
-
def to_s
|
133
|
-
return "@[#{@name}] #{@template.to_s} @[#{@delimeter.inspect}]"
|
134
|
-
end
|
129
|
+
def to_s; "@[#{@name}] #{@template.to_s} @[#{@delimeter.inspect}]"; end
|
135
130
|
end
|
136
131
|
|
137
132
|
# Represents an timeformat placeholder partial in a GTimeFormat
|
@@ -148,9 +143,7 @@ module General
|
|
148
143
|
# Initializes the GTimeFormatPlaceholder with the given match
|
149
144
|
#
|
150
145
|
# Parameter: match - the match data from the string being parsed
|
151
|
-
def initialize match
|
152
|
-
@type = match[:type]
|
153
|
-
end
|
146
|
+
def initialize(match); @type = match[:type]; end
|
154
147
|
|
155
148
|
# Returns the value of the timeformat placeholder in the given time value
|
156
149
|
# formatted according to the time format type
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: general
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anshul Kharbanda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|