Class: RubyIdn
- Inherits:
-
Object
- Object
- RubyIdn
- Defined in:
- lib/ruby_idn.rb,
lib/ruby_idn/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
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.
7 8 9 |
# File 'lib/ruby_idn.rb', line 7 def initialize(name:) @name = name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/ruby_idn.rb', line 5 def name @name end |
Class Method Details
.to_ascii(domain) ⇒ Object
24 25 26 27 |
# File 'lib/ruby_idn.rb', line 24 def to_ascii(domain) ret_domain = to_stringprep(domain) call_idn(domain: ret_domain, options: '--idna-to-ascii') end |
.to_nameprep(domain) ⇒ Object
38 39 40 |
# File 'lib/ruby_idn.rb', line 38 def to_nameprep(domain) call_idn(domain: domain, options: ['--profile', 'Nameprep']) end |
.to_stringprep(domain) ⇒ Object
34 35 36 |
# File 'lib/ruby_idn.rb', line 34 def to_stringprep(domain) call_idn(domain: domain, options: '--stringprep') end |
.to_unicode(domain) ⇒ Object
29 30 31 32 |
# File 'lib/ruby_idn.rb', line 29 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
15 16 17 |
# File 'lib/ruby_idn.rb', line 15 def ascii_name self.class.to_ascii(name) end |
#unicode_name ⇒ Object
19 20 21 |
# File 'lib/ruby_idn.rb', line 19 def unicode_name self.class.to_unicode(name) end |