Class: Refinery::Generators::GeneratedAttribute
- Inherits:
-
Rails::Generators::GeneratedAttribute
- Object
- Rails::Generators::GeneratedAttribute
- Refinery::Generators::GeneratedAttribute
- Defined in:
- lib/refinery/generators/generated_attribute.rb
Instance Attribute Summary collapse
-
#refinery_type ⇒ Object
Returns the value of attribute refinery_type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, type = nil, index_type = false, attr_options = {}) ⇒ GeneratedAttribute
constructor
A new instance of GeneratedAttribute.
- #reference? ⇒ Boolean
Constructor Details
#initialize(name, type = nil, index_type = false, attr_options = {}) ⇒ GeneratedAttribute
Returns a new instance of GeneratedAttribute.
14 15 16 17 18 |
# File 'lib/refinery/generators/generated_attribute.rb', line 14 def initialize(name, type=nil, index_type=false, ={}) super self.refinery_type = type self.type = refinerize_type(type) end |
Instance Attribute Details
#refinery_type ⇒ Object
Returns the value of attribute refinery_type.
6 7 8 |
# File 'lib/refinery/generators/generated_attribute.rb', line 6 def refinery_type @refinery_type end |
Class Method Details
.reference?(type) ⇒ Boolean
9 10 11 |
# File 'lib/refinery/generators/generated_attribute.rb', line 9 def reference?(type) [:references, :belongs_to, :image, :resource].include? type end |
Instance Method Details
#reference? ⇒ Boolean
20 21 22 |
# File 'lib/refinery/generators/generated_attribute.rb', line 20 def reference? self.class.reference?(refinery_type) end |