sass 3.3.0.alpha.181 → 3.3.0.alpha.184

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/REVISION CHANGED
@@ -1 +1 @@
1
- dca1498acda9d3549cc10e87045f75516e494284
1
+ 9c8ae2980333f2715678c6737448ef738e0bb0cb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.3.0.alpha.181
1
+ 3.3.0.alpha.184
@@ -1 +1 @@
1
- 17 June 2013 21:59:02 GMT
1
+ 11 June 2013 21:31:46 GMT
@@ -1481,30 +1481,28 @@ module Sass::Script
1481
1481
  # Gets the nth item in a list.
1482
1482
  #
1483
1483
  # Note that unlike some languages, the first item in a Sass list is number 1,
1484
- # the second number 2, and so forth. You can also use negative numbers to
1485
- # count from the end of the list. So -1 is the last item, -2 is the
1486
- # second-to-last item, etc.
1484
+ # the second number 2, and so forth.
1487
1485
  #
1488
1486
  # @example
1489
1487
  # nth(10px 20px 30px, 1) => 10px
1490
1488
  # nth((Helvetica, Arial, sans-serif), 3) => sans-serif
1491
- # nth((red, green, blue), -2) => green
1492
1489
  # @param list [Value] The list
1493
1490
  # @param n [Sass::Script::Value::Number] The index into the list
1494
1491
  # @return [Sass::Script::Value::Base] The nth item in the list
1495
- # @raise [ArgumentError] If `n` isn't an integer whose absolute value is between 1 and the list's length.
1492
+ # @raise [ArgumentError] If `n` isn't an integer between 1 and the list's length.
1496
1493
  def nth(list, n)
1497
1494
  assert_type n, :Number
1498
- if !n.int? || n.to_i == 0
1499
- raise ArgumentError.new("List index #{n} must be a non-zero integer")
1495
+ if !n.int?
1496
+ raise ArgumentError.new("List index #{n} must be an integer")
1497
+ elsif n.to_i < 1
1498
+ raise ArgumentError.new("List index #{n} must be greater than or equal to 1")
1500
1499
  elsif list.to_a.size == 0
1501
1500
  raise ArgumentError.new("List index is #{n} but list has no items")
1502
- elsif n.to_i.abs > (size = list.to_a.size)
1501
+ elsif n.to_i > (size = list.to_a.size)
1503
1502
  raise ArgumentError.new("List index is #{n} but list is only #{size} item#{'s' if size != 1} long")
1504
1503
  end
1505
1504
 
1506
- index = n.to_i > 0 ? n.to_i - 1 : n.to_i
1507
- list.to_a[index]
1505
+ list.to_a[n.to_i - 1]
1508
1506
  end
1509
1507
  declare :nth, [:list, :n]
1510
1508
 
@@ -1017,14 +1017,12 @@ MSG
1017
1017
  def test_nth
1018
1018
  assert_equal("1", evaluate("nth(1 2 3, 1)"))
1019
1019
  assert_equal("2", evaluate("nth(1 2 3, 2)"))
1020
- assert_equal("3", evaluate("nth(1 2 3, -1)"))
1021
- assert_equal("1", evaluate("nth(1 2 3, -3)"))
1022
1020
  assert_equal("3", evaluate("nth((1, 2, 3), 3)"))
1023
1021
  assert_equal("foo", evaluate("nth(foo, 1)"))
1024
1022
  assert_equal("bar baz", evaluate("nth(foo (bar baz) bang, 2)"))
1025
- assert_error_message("List index 0 must be a non-zero integer for `nth'", "nth(foo, 0)")
1026
- assert_error_message("List index is -10 but list is only 1 item long for `nth'", "nth(foo, -10)")
1027
- assert_error_message("List index 1.5 must be a non-zero integer for `nth'", "nth(foo, 1.5)")
1023
+ assert_error_message("List index 0 must be greater than or equal to 1 for `nth'", "nth(foo, 0)")
1024
+ assert_error_message("List index -10 must be greater than or equal to 1 for `nth'", "nth(foo, -10)")
1025
+ assert_error_message("List index 1.5 must be an integer for `nth'", "nth(foo, 1.5)")
1028
1026
  assert_error_message("List index is 5 but list is only 4 items long for `nth'", "nth(1 2 3 4, 5)")
1029
1027
  assert_error_message("List index is 2 but list is only 1 item long for `nth'", "nth(foo, 2)")
1030
1028
  assert_error_message("List index is 1 but list has no items for `nth'", "nth((), 1)")
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- hash: 592302695
4
+ hash: 592302717
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 3
9
9
  - 0
10
10
  - alpha
11
- - 181
12
- version: 3.3.0.alpha.181
11
+ - 184
12
+ version: 3.3.0.alpha.184
13
13
  platform: ruby
14
14
  authors:
15
15
  - Nathan Weizenbaum
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2013-06-17 00:00:00 -04:00
22
+ date: 2013-06-11 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency