Class: XSD::XSDHexBinary

Inherits:
XSDAnySimpleType show all
Defined in:
lib/xsd/datatypes.rb

Direct Known Subclasses

SOAP::SOAPHexBinary

Constant Summary collapse

Type =
QName.new(Namespace, HexBinaryLiteral)

Constants included from XSD

AnySimpleTypeLiteral, AnySimpleTypeName, AnyTypeLiteral, AnyTypeName, AnyURILiteral, AttrNilName, AttrType, AttrTypeName, Base64BinaryLiteral, BooleanLiteral, ByteLiteral, DateLiteral, DateTimeLiteral, DecimalLiteral, DoubleLiteral, DurationLiteral, ENTITIESLiteral, ENTITYLiteral, FloatLiteral, GDayLiteral, GMonthDayLiteral, GMonthLiteral, GYearLiteral, GYearMonthLiteral, HexBinaryLiteral, IDLiteral, IDREFLiteral, IDREFSLiteral, InstanceNamespace, IntLiteral, IntegerLiteral, LanguageLiteral, LongLiteral, NCNameLiteral, NMTOKENLiteral, NMTOKENSLiteral, NameLiteral, Namespace, NegativeIntegerLiteral, NilLiteral, NilValue, NonNegativeIntegerLiteral, NonPositiveIntegerLiteral, NormalizedStringLiteral, PositiveIntegerLiteral, QNameLiteral, ShortLiteral, StringLiteral, TimeLiteral, TokenLiteral, UnsignedByteLiteral, UnsignedIntLiteral, UnsignedLongLiteral, UnsignedShortLiteral

Instance Attribute Summary

Attributes inherited from XSDAnySimpleType

#data, #is_nil

Attributes inherited from NSDBase

#type

Instance Method Summary collapse

Methods inherited from XSDAnySimpleType

#check_lexical_format, #set, #to_s

Methods inherited from NSDBase

inherited, #init, types

Constructor Details

#initialize(value = nil) ⇒ XSDHexBinary

String in Ruby could be a binary.



897
898
899
# File 'lib/xsd/datatypes.rb', line 897

def initialize(value = nil)
  init(Type, value)
end

Instance Method Details

#set_encoded(value) ⇒ Object



901
902
903
904
905
906
907
# File 'lib/xsd/datatypes.rb', line 901

def set_encoded(value)
  if /^[0-9a-fA-F]*$/ !~ value
    raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
  end
  @data = String.new(value).strip
  @is_nil = false
end

#stringObject



909
910
911
# File 'lib/xsd/datatypes.rb', line 909

def string
  [@data].pack("H*")
end