Class: JAXB2Ruby::Node
- Inherits:
-
Object
- Object
- JAXB2Ruby::Node
- Defined in:
- lib/jaxb2ruby/classes.rb
Instance Attribute Summary collapse
-
#accessor ⇒ Object
readonly
Returns the value of attribute accessor.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#local_name ⇒ Object
readonly
Returns the value of attribute local_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #array? ⇒ Boolean
- #hash? ⇒ Boolean
-
#initialize(name, options = {}) ⇒ Node
constructor
A new instance of Node.
- #required? ⇒ Boolean
Constructor Details
#initialize(name, options = {}) ⇒ Node
Returns a new instance of Node.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/jaxb2ruby/classes.rb', line 52 def initialize(name, = {}) @name = @local_name = name @accessor = ([:accessor] || name).underscore # If this conflicts with a Java keyword it will start with an underscore @accessor.sub!(/\A_/, "") @namespace = [:namespace] @name = sprintf "%s:%s", @namespace.prefix, @local_name if @namespace @default = [:default] @required = !![:required] @type = [:type] # TODO: this isn't used. Future plans? @array = !![:array] @hash = false # Uhhhh, I think this might need some revisiting, esp. with xsd:enumeration if @type.is_a?(Array) @accessor = @accessor.pluralize if @type.one? @array = true @type = @type.shift else @hash = true end end end |
Instance Attribute Details
#accessor ⇒ Object (readonly)
Returns the value of attribute accessor.
49 50 51 |
# File 'lib/jaxb2ruby/classes.rb', line 49 def accessor @accessor end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
50 51 52 |
# File 'lib/jaxb2ruby/classes.rb', line 50 def default @default end |
#local_name ⇒ Object (readonly)
Returns the value of attribute local_name.
47 48 49 |
# File 'lib/jaxb2ruby/classes.rb', line 47 def local_name @local_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
46 47 48 |
# File 'lib/jaxb2ruby/classes.rb', line 46 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
48 49 50 |
# File 'lib/jaxb2ruby/classes.rb', line 48 def namespace @namespace end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
45 46 47 |
# File 'lib/jaxb2ruby/classes.rb', line 45 def type @type end |
Instance Method Details
#array? ⇒ Boolean
87 88 89 |
# File 'lib/jaxb2ruby/classes.rb', line 87 def array? @array end |
#hash? ⇒ Boolean
83 84 85 |
# File 'lib/jaxb2ruby/classes.rb', line 83 def hash? @hash end |
#required? ⇒ Boolean
91 92 93 |
# File 'lib/jaxb2ruby/classes.rb', line 91 def required? @required end |