Class: String

Inherits:
Object show all
Defined in:
lib/nydp/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#_hex_ordObject



108
# File 'lib/nydp/core_ext.rb', line 108

def _hex_ord       ; ord.to_s(16).rjust(2, '0') ; end

#_nydp_name_to_rb_nameObject

_hex_ord only works for characters whose #ord is < 256, ie #bytes returns a single-element array this should allow for two-way conversion of names containing the characters in the regexp even though we don’t use two-way conversion anywhere just yet



105
# File 'lib/nydp/core_ext.rb', line 105

def _nydp_name_to_rb_name ; self.gsub(/[\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]/) { |chr| "_#{chr._hex_ord}"}.to_sym ; end

#as_method_nameObject



106
# File 'lib/nydp/core_ext.rb', line 106

def as_method_name ; self.gsub(/-/, '_').to_sym ; end

#nydp_typeObject



107
# File 'lib/nydp/core_ext.rb', line 107

def nydp_type      ; :string                    ; end