Class: Sassconf::ConfigManager
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
24
|
# File 'lib/sassconf/config_manager.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)'
logger.info("Eval config file: #{file_path}")
eval_line = __LINE__ + 1
eval("#{inject_array} \n #{source_file} \n #{collect_variables}", reader_binding, file_path, __LINE__ - eval_line)
end
|
#variable_hash ⇒ Object
38
39
40
|
# File 'lib/sassconf/config_manager.rb', line 38
def variable_hash
@vh
end
|
#variable_with_value_hash ⇒ Object
42
43
44
|
# File 'lib/sassconf/config_manager.rb', line 42
def variable_with_value_hash
@vwvh
end
|
#watch_update(file_path, activate) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/sassconf/config_manager.rb', line 26
def watch_update(file_path, activate)
Util.pre_check(activate.is_boolean?, 'Activate is no boolean type.')
if (activate)
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.")
FileWatcher.new([file_path]).watch do |filename, event|
if (event == :changed)
yield(filename)
end
end
end
end
|