Class: RegexRestrictedString
- Inherits:
-
Object
- Object
- RegexRestrictedString
- Includes:
- SerializableToXml
- Defined in:
- lib/voruby/misc.rb
Overview
Regex-restricted string
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(s) ⇒ Object
-
#initialize(s) ⇒ RegexRestrictedString
constructor
A new instance of RegexRestrictedString.
- #regex ⇒ Object
- #to_s ⇒ Object
- #to_xml(name = nil, ns = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(s) ⇒ RegexRestrictedString
Returns a new instance of RegexRestrictedString.
323 324 325 |
# File 'lib/voruby/misc.rb', line 323 def initialize(s) self.value = s end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
319 320 321 |
# File 'lib/voruby/misc.rb', line 319 def value @value end |
Class Method Details
.from_xml(xml) ⇒ Object
347 348 349 350 |
# File 'lib/voruby/misc.rb', line 347 def self.from_xml(xml) root = element_from(xml) self.new(root.text) end |
Instance Method Details
#==(s) ⇒ Object
335 336 337 |
# File 'lib/voruby/misc.rb', line 335 def ==(s) self.value == s.value end |
#regex ⇒ Object
327 |
# File 'lib/voruby/misc.rb', line 327 def regex; /.*/ end |
#to_s ⇒ Object
339 |
# File 'lib/voruby/misc.rb', line 339 def to_s; self.value.to_s end |
#to_xml(name = nil, ns = nil) ⇒ Object
341 342 343 344 345 |
# File 'lib/voruby/misc.rb', line 341 def to_xml(name=nil, ns=nil) el = element(name, ns) el.text = self.value el end |