class Docks::Languages::Sass
Public Class Methods
extensions()
click to toggle source
# File lib/docks/languages/sass_language.rb, line 9 def self.extensions; %w(scss sass) end
symbol_sources()
click to toggle source
# File lib/docks/languages/sass_language.rb, line 10 def self.symbol_sources; SymbolSources::Sass end
type()
click to toggle source
# File lib/docks/languages/sass_language.rb, line 8 def self.type; Docks::Types::Languages::STYLE end
Public Instance Methods
parser()
click to toggle source
# File lib/docks/languages/sass_language.rb, line 26 def parser; Docks::Parsers::Sass.instance end
signature_for(symbol)
click to toggle source
# 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
Protected Instance Methods
variable_presentation(symbol, type = :variable)
click to toggle source
# File lib/docks/languages/sass_language.rb, line 30 def variable_presentation(symbol, type = :variable) prefix = type == :variable ? "$" : "%" "#{prefix unless symbol.start_with?(prefix)}#{symbol}" end