Class: SchemaReader::Table
- Inherits:
-
Object
- Object
- SchemaReader::Table
- Defined in:
- lib/schema_reader.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, attributes) ⇒ Table
constructor
A new instance of Table.
Constructor Details
#initialize(name, attributes) ⇒ Table
Returns a new instance of Table.
91 92 93 |
# File 'lib/schema_reader.rb', line 91 def initialize(name, attributes) @name, @attributes = name, attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
89 90 91 |
# File 'lib/schema_reader.rb', line 89 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
89 90 91 |
# File 'lib/schema_reader.rb', line 89 def name @name end |
Class Method Details
.parse(table_data) ⇒ Object
95 96 97 98 99 100 |
# File 'lib/schema_reader.rb', line 95 def self.parse(table_data) return unless name = table_data[/table "(.+)"/] name = $1 atts = table_data.lines.to_a.select {|line| line =~ /t\.\w+/ }.map {|att| Attribute.parse att } Table.new(name, atts) end |