Class: DBCode::SQLFile
- Inherits:
-
Object
- Object
- DBCode::SQLFile
- Defined in:
- lib/dbcode/sql_file.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #dependency_names ⇒ Object
-
#initialize(name:, contents:) ⇒ SQLFile
constructor
A new instance of SQLFile.
- #to_sql ⇒ Object
Constructor Details
#initialize(name:, contents:) ⇒ SQLFile
Returns a new instance of SQLFile.
5 6 7 |
# File 'lib/dbcode/sql_file.rb', line 5 def initialize(name:, contents:) @name, @contents = name, contents end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
3 4 5 |
# File 'lib/dbcode/sql_file.rb', line 3 def contents @contents end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/dbcode/sql_file.rb', line 3 def name @name end |
Instance Method Details
#dependency_names ⇒ Object
9 10 11 |
# File 'lib/dbcode/sql_file.rb', line 9 def dependency_names to_sql.scan(/^\s*-- require (\S+)\s*$/).flatten end |
#to_sql ⇒ Object
13 14 15 |
# File 'lib/dbcode/sql_file.rb', line 13 def to_sql @contents end |