Module: DbMeta::Oracle::Helper
- Included in:
- Base, ConstraintCollection, GrantCollection, Objects, Objects, Oracle, SynonymCollection, TableDataCollection
- Defined in:
- lib/db_meta/oracle/helper.rb
Instance Method Summary collapse
- #block(title, size = 80) ⇒ Object
- #create_folder(folder) ⇒ Object
- #pluralize(n, singular, plural = nil) ⇒ Object
- #remove_folder(folder) ⇒ Object
- #type_sequence(type) ⇒ Object
- #write_buffer_to_file(buffer, file) ⇒ Object
Instance Method Details
#block(title, size = 80) ⇒ Object
4 5 6 7 |
# File 'lib/db_meta/oracle/helper.rb', line 4 def block(title, size = 80) line = "-- " + ("-" * (size - 3)) [line, "-- #{title}", line].join("\n") end |
#create_folder(folder) ⇒ Object
22 23 24 25 |
# File 'lib/db_meta/oracle/helper.rb', line 22 def create_folder(folder) Dir.mkdir(folder.downcase.tr(" ", "_")) rescue end |
#pluralize(n, singular, plural = nil) ⇒ Object
27 28 29 30 |
# File 'lib/db_meta/oracle/helper.rb', line 27 def pluralize(n, singular, plural = nil) return singular if n == 1 plural || (singular + "s") end |
#remove_folder(folder) ⇒ Object
18 19 20 |
# File 'lib/db_meta/oracle/helper.rb', line 18 def remove_folder(folder) FileUtils.rm_rf(folder) end |
#type_sequence(type) ⇒ Object
9 10 11 |
# File 'lib/db_meta/oracle/helper.rb', line 9 def type_sequence(type) TYPE_SEQUENCE[type] || 99 end |
#write_buffer_to_file(buffer, file) ⇒ Object
13 14 15 16 |
# File 'lib/db_meta/oracle/helper.rb', line 13 def write_buffer_to_file(buffer, file) buffer = buffer.join("\n") if buffer.is_a?(Array) File.write(file.downcase.tr(" ", "_"), buffer) end |