Class: SchemaToScaffold::Attribute
- Inherits:
-
Object
- Object
- SchemaToScaffold::Attribute
- Defined in:
- lib/schema_to_scaffold/attribute.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, name) ⇒ Attribute
constructor
A new instance of Attribute.
- #to_script ⇒ Object
Constructor Details
#initialize(type, name) ⇒ Attribute
Returns a new instance of Attribute.
6 7 8 |
# File 'lib/schema_to_scaffold/attribute.rb', line 6 def initialize(type, name) @name, @type = name, type end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/schema_to_scaffold/attribute.rb', line 4 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/schema_to_scaffold/attribute.rb', line 4 def type @type end |
Class Method Details
Instance Method Details
#to_script ⇒ Object
10 11 12 |
# File 'lib/schema_to_scaffold/attribute.rb', line 10 def to_script "#{name}:#{type}" unless ["created_at","updated_at"].include? name end |