Class: Docks::Languages::Sass

Inherits:
Base
  • Object
show all
Defined in:
lib/docks/languages/sass_language.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#load_stub, #renderer

Class Method Details

.extensionsObject



9
# File 'lib/docks/languages/sass_language.rb', line 9

def self.extensions; %w(scss sass) end

.symbol_sourcesObject



10
# File 'lib/docks/languages/sass_language.rb', line 10

def self.symbol_sources; SymbolSources::Sass end

.typeObject



8
# File 'lib/docks/languages/sass_language.rb', line 8

def self.type; Docks::Types::Languages::STYLE end

Instance Method Details

#parserObject



26
# File 'lib/docks/languages/sass_language.rb', line 26

def parser; Docks::Parsers::Sass.instance end

#signature_for(symbol) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/docks/languages/sass_language.rb', line 12

def signature_for(symbol)
  return unless [Types::Symbol::FUNCTION, Types::Symbol::MIXIN].include?(symbol.symbol_type)
  directive = "@#{symbol.symbol_type == Types::Symbol::FUNCTION ? "function" : "mixin"} #{symbol.name}"

  params = symbol.fetch(:params, []).map do |param|
    name, default = param.name, param.default
    param_string = variable_presentation(name)
    param_string << ": #{default}" if default
    param_string
  end

  "#{directive}(#{params.join(", ")}) { /* ... */ }"
end