Class: DbMeta::Oracle::ConstraintCollection
- Inherits:
-
Object
- Object
- DbMeta::Oracle::ConstraintCollection
- Includes:
- Helper
- Defined in:
- lib/db_meta/oracle/types/constraint_collection.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#extract_type ⇒ Object
readonly
Returns the value of attribute extract_type.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #<<(object) ⇒ Object
- #ddl_drop ⇒ Object
- #empty? ⇒ Boolean
- #extract(args = {}) ⇒ Object
-
#initialize(args = {}) ⇒ ConstraintCollection
constructor
A new instance of ConstraintCollection.
- #system_object? ⇒ Boolean
Methods included from Helper
#block, #create_folder, #pluralize, #remove_folder, #type_sequence, #write_buffer_to_file
Constructor Details
#initialize(args = {}) ⇒ ConstraintCollection
Returns a new instance of ConstraintCollection.
8 9 10 11 12 13 14 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 8 def initialize(args = {}) @name = args[:name] @type = args[:type] @status = :valid @extract_type = :default @collection = [] end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
6 7 8 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 6 def collection @collection end |
#extract_type ⇒ Object (readonly)
Returns the value of attribute extract_type.
6 7 8 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 6 def extract_type @extract_type end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 6 def name @name end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 6 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 6 def type @type end |
Instance Method Details
#<<(object) ⇒ Object
20 21 22 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 20 def <<(object) @collection << object end |
#ddl_drop ⇒ Object
35 36 37 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 35 def ddl_drop "-- will automatically be dropped with table object" end |
#empty? ⇒ Boolean
16 17 18 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 16 def empty? @collection.size == 0 end |
#extract(args = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 24 def extract(args = {}) buffer = [block(@name)] title = nil @collection.sort_by { |o| [o.table_name, o.name] }.each do |object| buffer << block(object.table_name, 40) if title != object.table_name buffer << object.extract(args) title = object.table_name end buffer.join("\n") end |
#system_object? ⇒ Boolean
39 40 41 |
# File 'lib/db_meta/oracle/types/constraint_collection.rb', line 39 def system_object? false end |