Module: SassC::Native

Extended by:
FFI::Library
Defined in:
lib/sassc/native.rb,
lib/sassc/native/sass_value.rb,
lib/sassc/native/string_list.rb,
lib/sassc/native/sass2scss_api.rb,
lib/sassc/native/sass_input_style.rb,
lib/sassc/native/sass_output_style.rb,
lib/sassc/native/native_context_api.rb,
lib/sassc/native/native_functions_api.rb

Defined Under Namespace

Classes: SassBoolean, SassColor, SassError, SassList, SassMap, SassMapPair, SassNull, SassNumber, SassString, SassUnknown, SassValue, SassWarning, StringList

Constant Summary collapse

SassTag =
enum(
  :sass_boolean,
  :sass_number,
  :sass_color,
  :sass_string,
  :sass_list,
  :sass_map,
  :sass_null,
  :sass_error,
  :sass_warning
)
SassSeparator =
enum(
  :sass_comma,
  :sass_space
)
SassInputStyle =
enum(
  :sass_context_null,
  :sass_context_file,
  :sass_context_data,
  :sass_context_folder
)
SassOutputStyle =
enum(
  :sass_style_nested,
  :sass_style_expanded,
  :sass_style_compact,
  :sass_style_compressed
)

Class Method Summary collapse

Class Method Details

.attach_function(*args) ⇒ Object

Remove the redundant “sass_” from the beginning of every method name



39
40
41
42
43
44
45
46
47
# File 'lib/sassc/native.rb', line 39

def self.attach_function(*args)
  return super if args.size != 3

  if args[0] =~ /^sass_/
    args.unshift args[0].to_s.sub(/^sass_/, "")
  end

  super(*args)
end

.context_get_included_files(*args) ⇒ Object



140
141
142
# File 'lib/sassc/native/native_context_api.rb', line 140

def self.context_get_included_files(*args)
  return_string_array _context_get_included_files(*args)
end

.make_data_context(data) ⇒ Object



17
18
19
# File 'lib/sassc/native/native_context_api.rb', line 17

def self.make_data_context(data)
  _make_data_context(Native.native_string(data))
end

.native_string(string) ⇒ Object



54
55
56
57
58
# File 'lib/sassc/native.rb', line 54

def self.native_string(string)
  m = FFI::MemoryPointer.from_string(string)
  m.autorelease = false
  m
end

.return_string_array(ptr) ⇒ Object



50
51
52
# File 'lib/sassc/native.rb', line 50

def self.return_string_array(ptr)
  ptr.null? ? [] : ptr.get_array_of_string(0).compact
end

.string_get_type(native_value) ⇒ Object



84
85
86
# File 'lib/sassc/native/native_functions_api.rb', line 84

def self.string_get_type(native_value)
  string_is_quoted(native_value) ? :string : :identifier
end