Class: Refinery::Generators::GeneratedAttribute

Inherits:
Rails::Generators::GeneratedAttribute
  • Object
show all
Defined in:
core/lib/refinery/generators/generated_attribute.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type = nil, index_type = false, attr_options = {}) ⇒ GeneratedAttribute



14
15
16
17
18
# File 'core/lib/refinery/generators/generated_attribute.rb', line 14

def initialize(name, type=nil, index_type=false, attr_options={})
  super
  self.refinery_type  = type
  self.type           = refinerize_type(type)
end

Instance Attribute Details

#refinery_typeObject

Returns the value of attribute refinery_type



6
7
8
# File 'core/lib/refinery/generators/generated_attribute.rb', line 6

def refinery_type
  @refinery_type
end

Class Method Details

.reference?(type) ⇒ Boolean



9
10
11
# File 'core/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 'core/lib/refinery/generators/generated_attribute.rb', line 20

def reference?
  self.class.reference?(refinery_type)
end