Class: RubyIdn
- Inherits:
-
Object
- Object
- RubyIdn
- Defined in:
- lib/ruby_idn.rb,
lib/ruby_idn/version.rb
Constant Summary collapse
- CHARACTER_CODE =
'ja_JP.UTF-8'.freeze
- VERSION =
"0.1.1"
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
- .to_ascii(domain) ⇒ Object
- .to_nameprep(domain) ⇒ Object
- .to_stringprep(domain) ⇒ Object
- .to_unicode(domain) ⇒ Object
Instance Method Summary collapse
- #ascii_name ⇒ Object
-
#initialize(name:) ⇒ RubyIdn
constructor
A new instance of RubyIdn.
- #unicode_name ⇒ Object
Constructor Details
#initialize(name:) ⇒ RubyIdn
Returns a new instance of RubyIdn.
8 9 10 |
# File 'lib/ruby_idn.rb', line 8 def initialize(name:) @name = name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/ruby_idn.rb', line 6 def name @name end |
Class Method Details
.to_ascii(domain) ⇒ Object
25 26 27 28 |
# File 'lib/ruby_idn.rb', line 25 def to_ascii(domain) ret_domain = to_stringprep(domain) call_idn(domain: ret_domain, options: '--idna-to-ascii') end |
.to_nameprep(domain) ⇒ Object
39 40 41 |
# File 'lib/ruby_idn.rb', line 39 def to_nameprep(domain) call_idn(domain: domain, options: ['--profile', 'Nameprep']) end |
.to_stringprep(domain) ⇒ Object
35 36 37 |
# File 'lib/ruby_idn.rb', line 35 def to_stringprep(domain) call_idn(domain: domain, options: '--stringprep') end |
.to_unicode(domain) ⇒ Object
30 31 32 33 |
# File 'lib/ruby_idn.rb', line 30 def to_unicode(domain) ret_domain = to_stringprep(domain) call_idn(domain: ret_domain, options: '--idna-to-unicode') end |
Instance Method Details
#ascii_name ⇒ Object
16 17 18 |
# File 'lib/ruby_idn.rb', line 16 def ascii_name self.class.to_ascii(name) end |
#unicode_name ⇒ Object
20 21 22 |
# File 'lib/ruby_idn.rb', line 20 def unicode_name self.class.to_unicode(name) end |