Class: PgTypes::FileVersion
- Inherits:
-
Object
- Object
- PgTypes::FileVersion
- Defined in:
- lib/pg_types/file_version.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(path) ⇒ FileVersion
constructor
A new instance of FileVersion.
- #sql_definition ⇒ Object
Constructor Details
#initialize(path) ⇒ FileVersion
Returns a new instance of FileVersion.
7 8 9 10 11 |
# File 'lib/pg_types/file_version.rb', line 7 def initialize(path) @path = Pathname.new(path) @name = @path.basename.to_s.sub(/_v\d+\.sql$/, "") @version = extract_version end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/pg_types/file_version.rb', line 5 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/pg_types/file_version.rb', line 5 def path @path end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
5 6 7 |
# File 'lib/pg_types/file_version.rb', line 5 def version @version end |
Instance Method Details
#sql_definition ⇒ Object
13 14 15 |
# File 'lib/pg_types/file_version.rb', line 13 def sql_definition File.read(path).strip end |