Class: Table
- Inherits:
-
Object
- Object
- Table
- Defined in:
- lib/active_hash_ext.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.
- #to_script(target) ⇒ Object
Constructor Details
#initialize(name, attributes) ⇒ Table
Returns a new instance of Table.
50 51 52 |
# File 'lib/active_hash_ext.rb', line 50 def initialize(name, attributes) @name, @attributes = name, attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
48 49 50 |
# File 'lib/active_hash_ext.rb', line 48 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
48 49 50 |
# File 'lib/active_hash_ext.rb', line 48 def name @name end |
Class Method Details
Instance Method Details
#to_script(target) ⇒ Object
54 55 56 57 |
# File 'lib/active_hash_ext.rb', line 54 def to_script(target) return "rails generate #{target} #{modelize name} #{attributes.map(&:to_script).reject{|x| x.nil? || x.empty?}.join(' ')}" if target == "scaffold" return "rails generate #{target} #{modelize name} #{attributes.map(&:to_script).reject{|x| x.nil? || x.empty?}.join(' ')}" if target == "factory_girl:model" end |