Top Level Namespace

Defined Under Namespace

Modules: Etc Classes: IO

Constant Summary collapse

C_ESC =
{
  "\\" => "\\\\",
  '"' => '\"',
  "\n" => '\n',
}
C_ESC_PAT =
Regexp.union(*C_ESC.keys)
CONST_PREFIXES =
{
  'SC' => 'for Etc.sysconf; See <tt>man sysconf</tt>',
  'CS' => 'for Etc.confstr; See <tt>man constr</tt>',
  'PC' => 'for IO#pathconf; See <tt>man fpathconf</tt>',
}
COMMENTS =
{}
DEFS =
h.to_a

Instance Method Summary collapse

Instance Method Details

#c_str(str) ⇒ Object



15
16
17
# File 'ext/etc/mkconstants.rb', line 15

def c_str(str)
  '"' + str.gsub(C_ESC_PAT) {|s| C_ESC[s]} + '"'
end

#each_constObject



69
70
71
72
73
# File 'ext/etc/mkconstants.rb', line 69

def each_const
  DEFS.each {|name, default_value|
    yield name, default_value
  }
end

#each_name(pat) ⇒ Object



75
76
77
78
79
80
# File 'ext/etc/mkconstants.rb', line 75

def each_name(pat)
  DEFS.each {|name, default_value|
    next if pat !~ name
    yield name
  }
end