Class: MkLangHelp

Inherits:
Object show all
Includes:
GeneratedMessage, LocalVariables
Defined in:
lib/langhelp/mklanghelp.rb

Constant Summary

Constants included from LocalVariables

LocalVariables::ANCHOR_BEGIN, LocalVariables::ANCHOR_END

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GeneratedMessage

#generated, #processing

Methods included from FilenameString

#abbreviate_filename, #abbreviate_filename!, #normalize_filename!

Methods included from LocalVariables

#insert_local_variables

Constructor Details

#initializeMkLangHelp

Returns a new instance of MkLangHelp.



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/langhelp/mklanghelp.rb', line 29

def initialize
  @langs = []
  @make_index_proc = {}

  @conf = ConfigScript.new("~/.langhelp/config")
  $langhelp_home = @conf.LANGHELP_HOME # GLOBAL!
  @index_suffix = ".e"
  @init_script = File.expand_path "~/.langhelp/mklanghelp-init.rb"
  @no_init = false
  @langs = @conf.lang.keys.map{|l| l.to_s}
end

Instance Attribute Details

#debug_modeObject

Returns the value of attribute debug_mode.



43
44
45
# File 'lib/langhelp/mklanghelp.rb', line 43

def debug_mode
  @debug_mode
end

#eval_exprObject

Returns the value of attribute eval_expr.



44
45
46
# File 'lib/langhelp/mklanghelp.rb', line 44

def eval_expr
  @eval_expr
end

#index_suffixObject

Returns the value of attribute index_suffix.



43
44
45
# File 'lib/langhelp/mklanghelp.rb', line 43

def index_suffix
  @index_suffix
end

#init_scriptObject

Returns the value of attribute init_script.



43
44
45
# File 'lib/langhelp/mklanghelp.rb', line 43

def init_script
  @init_script
end

#langhelp_homeObject

Returns the value of attribute langhelp_home.



42
43
44
# File 'lib/langhelp/mklanghelp.rb', line 42

def langhelp_home
  @langhelp_home
end

#langsObject (readonly)

Returns the value of attribute langs.



41
42
43
# File 'lib/langhelp/mklanghelp.rb', line 41

def langs
  @langs
end

#no_initObject

Returns the value of attribute no_init.



43
44
45
# File 'lib/langhelp/mklanghelp.rb', line 43

def no_init
  @no_init
end

#output_stdoutObject

Returns the value of attribute output_stdout.



44
45
46
# File 'lib/langhelp/mklanghelp.rb', line 44

def output_stdout
  @output_stdout
end

Instance Method Details

#write(langs_to_output) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/langhelp/mklanghelp.rb', line 55

def write(langs_to_output)
  prepare
  FileUtils.cd(langhelp_home, :verbose=> !output_stdout) do
    langs_to_output.each do |lang|
      @make_index_proc[lang][]
    end
  end
end