Class: Docks::SymbolSources::Sass

Inherits:
Base
  • Object
show all
Defined in:
lib/docks/symbol_sources/sass_symbol_source.rb

Constant Summary collapse

VALUE_SYMBOLS =
%w(arglist bool color list map null number string)

Instance Method Summary collapse

Instance Method Details

#path_for(symbol) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/docks/symbol_sources/sass_symbol_source.rb', line 18

def path_for(symbol)
  if symbol.downcase == "function"
    "http://sass-lang.com/documentation/Sass/Script/Script/Functions.html"
  else
    "http://sass-lang.com/documentation/Sass/Script/Value/#{symbol.capitalize}.html"
  end
end

#recognizes?(symbol, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
# File 'lib/docks/symbol_sources/sass_symbol_source.rb', line 10

def recognizes?(symbol, options = {})
  language = options.fetch(:language, nil)
  return false if language && Languages.language_for(language) != Languages::Sass.instance

  symbol = symbol.downcase
  VALUE_SYMBOLS.include?(symbol) || symbol == "function"
end