Class: String
Instance Method Summary collapse
- #_hex_ord ⇒ Object
-
#_nydp_name_to_rb_name ⇒ Object
_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.
- #as_method_name ⇒ Object
- #nydp_type ⇒ Object
Instance Method Details
#_hex_ord ⇒ Object
108 |
# File 'lib/nydp/core_ext.rb', line 108 def _hex_ord ; ord.to_s(16).rjust(2, '0') ; end |
#_nydp_name_to_rb_name ⇒ Object
_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_name ⇒ Object
106 |
# File 'lib/nydp/core_ext.rb', line 106 def as_method_name ; self.gsub(/-/, '_').to_sym ; end |
#nydp_type ⇒ Object
107 |
# File 'lib/nydp/core_ext.rb', line 107 def nydp_type ; :string ; end |