sassy-strings 0.2.1 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/sassy-strings.rb +19 -8
  2. metadata +3 -4
@@ -11,12 +11,12 @@ module Sass::Script::Functions
11
11
 
12
12
  # Split String
13
13
  def split_string(string, key)
14
- items = string.value.split(key.value)
15
- if items.count == 1
16
- Sass::Script::Bool.new(false)
17
- else
18
- Sass::Script::List.new(items.map{|i| Sass::Script::String.new(i)}, :comma)
19
- end
14
+ items = string.value.split(/\s+#{Regexp.escape(key.value)}\s+/)
15
+ if items.count == 1
16
+ Sass::Script::Bool.new(false)
17
+ else
18
+ Sass::Script::List.new(items.map{|i| Sass::Script::String.new(i)}, :comma)
19
+ end
20
20
  end
21
21
 
22
22
  # String Position
@@ -28,11 +28,22 @@ module Sass::Script::Functions
28
28
  end
29
29
  end
30
30
 
31
+ # Converts a String to a Number
32
+ def str_to_number(string)
33
+ result = Sass::Script::Parser.parse(string.value, string.line || 0, 0)
34
+ case result
35
+ when Sass::Script::Number
36
+ result
37
+ else
38
+ raise Sass::SyntaxError, "#{string.to_sass} is not a number"
39
+ end
40
+ end
41
+
31
42
  end
32
43
 
33
44
  module SassyStrings
34
45
 
35
- VERSION = "0.2.1"
36
- DATE = "2013-01-22"
46
+ VERSION = "0.3"
47
+ DATE = "2013-01-23"
37
48
 
38
49
  end
metadata CHANGED
@@ -4,9 +4,8 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
7
+ - 3
8
+ version: "0.3"
10
9
  platform: ruby
11
10
  authors:
12
11
  - Sam Richard
@@ -14,7 +13,7 @@ autorequire:
14
13
  bindir: bin
15
14
  cert_chain: []
16
15
 
17
- date: 2013-01-22 00:00:00 -05:00
16
+ date: 2013-01-23 00:00:00 -05:00
18
17
  default_executable:
19
18
  dependencies:
20
19
  - !ruby/object:Gem::Dependency