safai 0.0.4 → 0.0.5
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/safai/clean.rb +7 -0
- data/lib/safai/money.rb +12 -0
- data/lib/safai.rb +8 -1
- metadata +2 -1
data/lib/safai/clean.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Safai::Clean
|
2
2
|
|
3
|
+
# Standardize how web URLs are presented
|
3
4
|
def self.url(link)
|
4
5
|
link = link.gsub("http://", "")
|
5
6
|
link = link.gsub("https://", "")
|
@@ -7,4 +8,10 @@ class Safai::Clean
|
|
7
8
|
return "http://#{link}"
|
8
9
|
end
|
9
10
|
|
11
|
+
# Remove the unnecessary .0 that gets added to floated strings
|
12
|
+
def self.floated_string(f)
|
13
|
+
f = f.to_s
|
14
|
+
return f.index(".0").nil? ? f : f[0, f.index(".0")]
|
15
|
+
end
|
16
|
+
|
10
17
|
end
|
data/lib/safai/money.rb
ADDED
data/lib/safai.rb
CHANGED
@@ -30,8 +30,14 @@ class Safai
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def amt(c, amount)
|
33
|
+
m = Money::Currency.new(c)
|
33
34
|
amount = sprintf("%0.02f", amount)
|
34
|
-
|
35
|
+
if !m.blank?
|
36
|
+
if !m.symbol.blank?
|
37
|
+
return "#{m.symbol} #{amount.to_s}".html_safe
|
38
|
+
end
|
39
|
+
end
|
40
|
+
return "#{c} #{amount.to_s}"
|
35
41
|
end
|
36
42
|
|
37
43
|
end
|
@@ -93,5 +99,6 @@ require 'safai/address'
|
|
93
99
|
require 'safai/regex'
|
94
100
|
require 'safai/clean'
|
95
101
|
require 'safai/gravatar'
|
102
|
+
require 'safai/money'
|
96
103
|
ActionView::Base.send :include, Safai::Helpers
|
97
104
|
ActionView::Base.send :include, Safai::DeviseHelpers
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/safai/address.rb
|
40
40
|
- lib/safai/clean.rb
|
41
41
|
- lib/safai/gravatar.rb
|
42
|
+
- lib/safai/money.rb
|
42
43
|
homepage: http://rubygems.org/gems/safai
|
43
44
|
licenses: []
|
44
45
|
post_install_message:
|