Class: Prune::PObjects::PHexadecimalString
- Defined in:
- lib/prune/p_objects/p_hexadecimal_string.rb
Instance Attribute Summary collapse
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
- #==(value) ⇒ Object
-
#initialize(string) ⇒ PHexadecimalString
constructor
A new instance of PHexadecimalString.
- #to_s ⇒ Object
Methods inherited from Base
#indent!, #outdent!, #space, #value_to_s
Constructor Details
#initialize(string) ⇒ PHexadecimalString
Returns a new instance of PHexadecimalString.
8 9 10 11 12 13 14 |
# File 'lib/prune/p_objects/p_hexadecimal_string.rb', line 8 def initialize(string) raise PHexadecimalStringTypeError unless string.instance_of?(String) @string = string.upcase raise PHexadecimalStringContentError unless /[0-9A-F]+/ === @string end |
Instance Attribute Details
#string ⇒ Object (readonly)
Returns the value of attribute string.
6 7 8 |
# File 'lib/prune/p_objects/p_hexadecimal_string.rb', line 6 def string @string end |
Instance Method Details
#==(value) ⇒ Object
16 17 18 19 |
# File 'lib/prune/p_objects/p_hexadecimal_string.rb', line 16 def ==(value) false unless value.instance_of?(self.class) @string == value.string end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/prune/p_objects/p_hexadecimal_string.rb', line 21 def to_s "<#{@string}>" end |