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


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

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

#each_constObject


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

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

#each_name(pat) ⇒ Object


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

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