Class: Sassconf::ConfigReader

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/sassconf/config_reader.rb

Constant Summary collapse

VARIABLE_PREFIX =
'arg_'
VARIABLE_WITH_VALUE_PREFIX =
'varg_'
ARRAY_FROM_STRING_SEPARATOR =
','

Instance Method Summary collapse

Methods included from Logging

activate, configure_logger_for, #logger, logger_for

Instance Method Details

#eval_rb_file(file_path, extern_string_array = String.empty) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sassconf/config_reader.rb', line 13

def eval_rb_file(file_path, extern_string_array = String.empty)
  Util.pre_check((file_path.is_string? and file_path.is_not_nil_or_empty? and File.exist?(file_path)), "\"rb\" file path is no string, nil, empty or doesn't exist.")
  Util.pre_check((extern_string_array.is_string? and !extern_string_array.nil?), 'Extern string array is no string or nil.')

  @bind_extern_string_array = extern_string_array
  inject_array = 'extern_args = create_array_from_string(@bind_extern_string_array);'
  source_file = File.read(file_path)
  collect_variables = '@vh = create_variable_hash(local_variables, binding); @vwvh = create_variable_with_value_hash(local_variables, binding)'
  eval("#{inject_array} \n #{source_file} \n #{collect_variables}", reader_binding)
  nil
end

#variable_hashObject



25
26
27
# File 'lib/sassconf/config_reader.rb', line 25

def variable_hash
  @vh
end

#variable_with_value_hashObject



29
30
31
# File 'lib/sassconf/config_reader.rb', line 29

def variable_with_value_hash
  @vwvh
end