Class: CloudQuery::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud_query/schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Schema

Returns a new instance of Schema.



5
6
7
8
# File 'lib/cloud_query/schema.rb', line 5

def initialize(name)
  @name   = name
  @fields = []
end

Instance Attribute Details

#fieldsObject

Returns the value of attribute fields.



3
4
5
# File 'lib/cloud_query/schema.rb', line 3

def fields
  @fields
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/cloud_query/schema.rb', line 3

def name
  @name
end

Instance Method Details

#to_xmlObject



10
11
12
13
14
15
16
# File 'lib/cloud_query/schema.rb', line 10

def to_xml
  Nokogiri::XML::Builder.new { |doc|
    doc.schema(:name => @name, :store => 'yes') {
      @fields.each { |field| field.to_node(doc) }
    }
  }.to_xml
end