SassyLists 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/SassyLists.rb CHANGED
@@ -17,7 +17,7 @@ Compass::Frameworks.register('SassyLists', :path => extension_path)
17
17
  # a prerelease version
18
18
  # Date is in the form of YYYY-MM-DD
19
19
  module SassyLists
20
- VERSION = "0.1.4"
20
+ VERSION = "0.2.0"
21
21
  DATE = "2013-10-25"
22
22
  end
23
23
 
@@ -27,4 +27,10 @@ end
27
27
 
28
28
  # module Sass::Script::Functions
29
29
  #
30
- # end
30
+ # end
31
+
32
+ module Sass::Script::Functions
33
+ def random(max = Sass::Script::Number.new(100))
34
+ Sass::Script::Number.new(rand(max.value), max.numerator_units, max.denominator_units)
35
+ end
36
+ end
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Returns a random value of $list
3
+ * -------------------------------------------------------------------------------
4
+ * @dependence `rand` (Ruby)
5
+ * -------------------------------------------------------------------------------
6
+ * @example random-value( (a, b, c, d, e) ) => c
7
+ * -------------------------------------------------------------------------------
8
+ * @param $list [List] : List
9
+ * -------------------------------------------------------------------------------
10
+ * @return [Literal]
11
+ */
12
+ @function random-value($list) {
13
+ @return nth($list, rand(length($list)));
14
+ }
@@ -35,6 +35,9 @@
35
35
  * purge($list)
36
36
  * Remove all false and null values from $list
37
37
  *
38
+ * random-value($list)
39
+ * Return random value from $list
40
+ *
38
41
  * remove($list, $value, $recursive: false)
39
42
  * Remove value(s) $value from $list
40
43
  *
@@ -82,6 +85,7 @@
82
85
  @import "SassyLists/loop";
83
86
  @import "SassyLists/prepend";
84
87
  @import "SassyLists/purge";
88
+ @import "SassyLists/random-value";
85
89
  @import "SassyLists/remove";
86
90
  @import "SassyLists/remove-duplicates";
87
91
  @import "SassyLists/remove-nth";
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SassyLists
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -64,6 +64,7 @@ files:
64
64
  - stylesheets/SassyLists/_loop.scss
65
65
  - stylesheets/SassyLists/_prepend.scss
66
66
  - stylesheets/SassyLists/_purge.scss
67
+ - stylesheets/SassyLists/_random-value.scss
67
68
  - stylesheets/SassyLists/_remove-duplicates.scss
68
69
  - stylesheets/SassyLists/_remove-nth.scss
69
70
  - stylesheets/SassyLists/_remove.scss