Class: SchemaReader::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/schema_reader.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name) ⇒ Attribute

Returns a new instance of Attribute.



74
75
76
# File 'lib/schema_reader.rb', line 74

def initialize(type, name)
  @name, @type = name, type
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



72
73
74
# File 'lib/schema_reader.rb', line 72

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



72
73
74
# File 'lib/schema_reader.rb', line 72

def type
  @type
end

Class Method Details

.parse(attribute) ⇒ Object



78
79
80
81
82
83
# File 'lib/schema_reader.rb', line 78

def self.parse(attribute)
  match = attribute.match(/t\.(\w+)\s+"(\w+)"/)
  if match
    Attribute.new(*match.captures)
  end
end