numerale 0.0.3 → 0.0.4
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.
- data/lib/numerale/version.rb +1 -1
- data/lib/numerale.rb +16 -7
- metadata +3 -3
data/lib/numerale/version.rb
CHANGED
data/lib/numerale.rb
CHANGED
@@ -124,32 +124,41 @@ class Numerale
|
|
124
124
|
end
|
125
125
|
|
126
126
|
|
127
|
-
def to_text(currency = "PLN")
|
127
|
+
def to_text(delimiter = "", currency = "PLN")
|
128
128
|
result = ""
|
129
129
|
result = "#{expand(@number[0], currency, 'full')}"
|
130
130
|
result += " " if result.strip != ""
|
131
|
+
result += "#{delimiter} " if delimiter != ""
|
131
132
|
result += "#{expand(@number[1], currency, 'frac')}"
|
132
133
|
puts result
|
133
134
|
end
|
134
135
|
end
|
135
136
|
|
136
137
|
class Float
|
137
|
-
def to_text(currency = "PLN")
|
138
|
+
def to_text(delimiter = "", currency = "PLN")
|
138
139
|
c = Numerale.new(self)
|
139
|
-
c.to_text(currency)
|
140
|
+
c.to_text(delimiter, currency)
|
140
141
|
end
|
141
142
|
end
|
142
143
|
|
143
144
|
class Fixnum
|
144
|
-
def to_text(currency = "PLN")
|
145
|
+
def to_text(delimiter = "", currency = "PLN")
|
145
146
|
c = Numerale.new(self)
|
146
|
-
c.to_text(currency)
|
147
|
+
c.to_text(delimiter, currency)
|
147
148
|
end
|
148
149
|
end
|
149
150
|
|
150
151
|
class BigDecimal
|
151
|
-
def to_text(currency = "PLN")
|
152
|
+
def to_text(delimiter = "", currency = "PLN")
|
153
|
+
f = self.to_f
|
154
|
+
f.to_text(delimiter, currency)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
class Bignum
|
159
|
+
def to_text(delimiter = "", currency = "PLN")
|
152
160
|
c = Numerale.new(self)
|
153
|
-
c.to_text(currency)
|
161
|
+
c.to_text(delimiter, currency)
|
154
162
|
end
|
155
163
|
end
|
164
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: numerale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Piotr Debosz
|