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)
COMMENTS =
{}
DEFS =
h.to_a

Instance Method Summary collapse

Instance Method Details

#c_str(str) ⇒ Object



15
16
17
# File 'mkconstants.rb', line 15

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

#each_constObject



56
57
58
59
60
# File 'mkconstants.rb', line 56

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

#each_name(pat) ⇒ Object



62
63
64
65
66
67
# File 'mkconstants.rb', line 62

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