Class: Cts::Mpx::Field
- Inherits:
-
Object
- Object
- Cts::Mpx::Field
- Includes:
- Creatable
- Defined in:
- lib/cts/mpx/field.rb
Overview
Indivudal field, contains the name, value, and an optional namespace
Instance Attribute Summary collapse
- #name name of the field(nameofthefield) ⇒ String
- #value value of the field(valueofthefield) ⇒ Object
- #xmlns namespace of the field(namespaceofthefield) ⇒ Hash
Instance Method Summary collapse
-
#custom? ⇒ Symbol
Determines if this field is a custom field or not.
-
#to_h ⇒ Hash
Return just the name value as key/value.
-
#xmlns=(xmlns) ⇒ Void
Set the namespace of the field.
Instance Attribute Details
#name name of the field(nameofthefield) ⇒ String
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cts/mpx/field.rb', line 10 class Field include Creatable attribute name: 'name', kind_of: String attribute name: 'value' attribute(name: 'xmlns', kind_of: Hash) { |o, xmlns| o.xmlns = xmlns if o.custom? } # Return just the name value as key/value # @return [Hash] def to_h { name => value } end # Determines if this field is a custom field or not # @return [Symbol] true if it is a custom field def custom? return true if name.include? "$" false end # Set the namespace of the field # @param [Hash] xmlns namespace of the fields # @return [Void] def xmlns=(xmlns) @xmlns = xmlns if name.include? '$' end end |
#value value of the field(valueofthefield) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cts/mpx/field.rb', line 10 class Field include Creatable attribute name: 'name', kind_of: String attribute name: 'value' attribute(name: 'xmlns', kind_of: Hash) { |o, xmlns| o.xmlns = xmlns if o.custom? } # Return just the name value as key/value # @return [Hash] def to_h { name => value } end # Determines if this field is a custom field or not # @return [Symbol] true if it is a custom field def custom? return true if name.include? "$" false end # Set the namespace of the field # @param [Hash] xmlns namespace of the fields # @return [Void] def xmlns=(xmlns) @xmlns = xmlns if name.include? '$' end end |
#xmlns namespace of the field(namespaceofthefield) ⇒ Hash
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cts/mpx/field.rb', line 10 class Field include Creatable attribute name: 'name', kind_of: String attribute name: 'value' attribute(name: 'xmlns', kind_of: Hash) { |o, xmlns| o.xmlns = xmlns if o.custom? } # Return just the name value as key/value # @return [Hash] def to_h { name => value } end # Determines if this field is a custom field or not # @return [Symbol] true if it is a custom field def custom? return true if name.include? "$" false end # Set the namespace of the field # @param [Hash] xmlns namespace of the fields # @return [Void] def xmlns=(xmlns) @xmlns = xmlns if name.include? '$' end end |
Instance Method Details
#custom? ⇒ Symbol
Determines if this field is a custom field or not
25 26 27 28 29 |
# File 'lib/cts/mpx/field.rb', line 25 def custom? return true if name.include? "$" false end |
#to_h ⇒ Hash
Return just the name value as key/value
19 20 21 |
# File 'lib/cts/mpx/field.rb', line 19 def to_h { name => value } end |
#xmlns=(xmlns) ⇒ Void
Set the namespace of the field
34 35 36 |
# File 'lib/cts/mpx/field.rb', line 34 def xmlns=(xmlns) @xmlns = xmlns if name.include? '$' end |