Class: Bhf::Data::Reflection
- Inherits:
-
Object
- Object
- Bhf::Data::Reflection
- Defined in:
- lib/bhf/data.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#overwrite_display_type ⇒ Object
readonly
Returns the value of attribute overwrite_display_type.
-
#overwrite_show_type ⇒ Object
readonly
Returns the value of attribute overwrite_show_type.
-
#reflection ⇒ Object
readonly
Returns the value of attribute reflection.
Instance Method Summary collapse
- #display_type ⇒ Object
- #form_type ⇒ Object
-
#initialize(reflection, options = {}) ⇒ Reflection
constructor
A new instance of Reflection.
- #macro ⇒ Object
- #name ⇒ Object
- #show_type ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(reflection, options = {}) ⇒ Reflection
Returns a new instance of Reflection.
99 100 101 102 103 104 105 106 107 |
# File 'lib/bhf/data.rb', line 99 def initialize(reflection, = {}) @reflection = reflection @info = [:info] @link = [:link].downcase.to_sym unless [:link].blank? @overwrite_type = [:overwrite_type].to_sym if [:overwrite_type] @overwrite_display_type = [:overwrite_display_type].to_sym if [:overwrite_display_type] @overwrite_show_type = [:overwrite_show_type].to_sym if [:overwrite_show_type] end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
97 98 99 |
# File 'lib/bhf/data.rb', line 97 def info @info end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
97 98 99 |
# File 'lib/bhf/data.rb', line 97 def link @link end |
#overwrite_display_type ⇒ Object (readonly)
Returns the value of attribute overwrite_display_type.
97 98 99 |
# File 'lib/bhf/data.rb', line 97 def overwrite_display_type @overwrite_display_type end |
#overwrite_show_type ⇒ Object (readonly)
Returns the value of attribute overwrite_show_type.
97 98 99 |
# File 'lib/bhf/data.rb', line 97 def overwrite_show_type @overwrite_show_type end |
#reflection ⇒ Object (readonly)
Returns the value of attribute reflection.
97 98 99 |
# File 'lib/bhf/data.rb', line 97 def reflection @reflection end |
Instance Method Details
#display_type ⇒ Object
130 131 132 133 |
# File 'lib/bhf/data.rb', line 130 def display_type return @overwrite_display_type if @overwrite_display_type :default end |
#form_type ⇒ Object
126 127 128 |
# File 'lib/bhf/data.rb', line 126 def form_type type end |
#macro ⇒ Object
109 110 111 112 |
# File 'lib/bhf/data.rb', line 109 def macro return :has_and_belongs_to_many if @reflection.macro == :has_many && @reflection.[:through] @reflection.macro end |
#name ⇒ Object
139 140 141 |
# File 'lib/bhf/data.rb', line 139 def name @reflection.name.to_s end |
#show_type ⇒ Object
135 136 137 |
# File 'lib/bhf/data.rb', line 135 def show_type return @overwrite_show_type if @overwrite_show_type end |
#type ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/bhf/data.rb', line 114 def type return @overwrite_type if @overwrite_type if macro == :has_and_belongs_to_many :check_box elsif macro == :belongs_to :select else :static end end |