general 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gpartials.rb +9 -16
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d49cd861bc37c7e61423c69040efbecdce41fc5f
4
- data.tar.gz: 443026a01739601b708586b4d6cb7672ce8e79f3
3
+ metadata.gz: 1009797918440470703fb9df531ce259dc30cd2e
4
+ data.tar.gz: 258532c1f86afa8ad744b8e57ad1384a0ae440f9
5
5
  SHA512:
6
- metadata.gz: 81c684e0819f4f5441028225a3fade0c9a78fae93fb5f778b20207c650892f6ac9d9fe22e0eea48d71c42a68de4119ea7177f30d63f924bdc765833a8f11b951
7
- data.tar.gz: 9dda9feed8a59687a99c73f1c7710767cfa17196b39b20551c3f628505c472d3759ee10ae52abef38bb0327a9cdb4e18a78740a08d8a05952c49841eeb3e2126
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 data
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
- return "@(#{@name} -> #{@operation})"
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.1
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-15 00:00:00.000000000 Z
11
+ date: 2016-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec