Class: Bhf::Platform::Attribute::Column
- Inherits:
-
Object
- Object
- Bhf::Platform::Attribute::Column
- Defined in:
- lib/bhf/platform/attribute/column.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #db_name ⇒ Object
- #display_type ⇒ Object
- #form_type ⇒ Object
-
#initialize(props, options = {}) ⇒ Column
constructor
A new instance of Column.
- #macro ⇒ Object
- #reflection ⇒ Object
- #reorderble ⇒ Object
- #show_type ⇒ Object
- #type_ignore_emtpy? ⇒ Boolean
Constructor Details
#initialize(props, options = {}) ⇒ Column
Returns a new instance of Column.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/bhf/platform/attribute/column.rb', line 6 def initialize(props, = {}) @name = props.name @title = [:title] @info = [:info] @type = props.type @options_form_type = [:form_type].to_sym if [:form_type] @options_display_type = [:display_type].to_sym if [:display_type] @options_show_type = [:show_type].to_sym if [:show_type] @pk = [:primary_key] end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
4 5 6 |
# File 'lib/bhf/platform/attribute/column.rb', line 4 def info @info end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/bhf/platform/attribute/column.rb', line 4 def name @name end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/bhf/platform/attribute/column.rb', line 4 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/bhf/platform/attribute/column.rb', line 4 def type @type end |
Instance Method Details
#db_name ⇒ Object
59 60 61 |
# File 'lib/bhf/platform/attribute/column.rb', line 59 def db_name name end |
#display_type ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/bhf/platform/attribute/column.rb', line 35 def display_type return @options_display_type if @options_display_type if name == @pk :primary_key elsif name == 'type' :type else supported_types(@type) end end |
#form_type ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/bhf/platform/attribute/column.rb', line 23 def form_type return @options_form_type if @options_form_type if name == @pk || name == 'updated_at' || name == 'created_at' :static elsif name == 'type' :type else supported_types(@type) end end |
#macro ⇒ Object
19 20 21 |
# File 'lib/bhf/platform/attribute/column.rb', line 19 def macro :column end |
#reflection ⇒ Object
55 56 57 |
# File 'lib/bhf/platform/attribute/column.rb', line 55 def reflection false end |
#reorderble ⇒ Object
63 64 65 |
# File 'lib/bhf/platform/attribute/column.rb', line 63 def reorderble true end |
#show_type ⇒ Object
51 52 53 |
# File 'lib/bhf/platform/attribute/column.rb', line 51 def show_type @options_show_type || display_type end |
#type_ignore_emtpy? ⇒ Boolean
47 48 49 |
# File 'lib/bhf/platform/attribute/column.rb', line 47 def type_ignore_emtpy? display_type == :boolean || display_type == :toggle end |