Module: Sass::Script::Functions

Defined in:
lib/nanoc/filters/sass/functions.rb

Instance Method Summary collapse

Instance Method Details

#nanoc(string, params = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/nanoc/filters/sass/functions.rb', line 4

def nanoc(string, params = {})
  assert_type string, :String
  assert_type params, :Hash
  result = options[:importer].filter.instance_eval(string.value)
  case result
  when TrueClass, FalseClass
    bool(result)
  when Array
    list(result, :comma)
  when Hash
    map(result)
  when nil
    null
  when Numeric
    number(result)
  else
    params['unquote'] ? unquoted_string(result) : quoted_string(result)
  end
end