Class: Bhf::Data::Field
- Inherits:
-
Object
- Object
- Bhf::Data::Field
- Defined in:
- lib/bhf/data.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
Instance Method Summary collapse
- #display_type ⇒ Object
- #form_type ⇒ Object
-
#initialize(props, options = {}, pk = 'id') ⇒ Field
constructor
A new instance of Field.
- #macro ⇒ Object
- #name ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(props, options = {}, pk = 'id') ⇒ Field
Returns a new instance of Field.
8 9 10 11 12 13 14 15 |
# File 'lib/bhf/data.rb', line 8 def initialize(props, = {}, pk = 'id') @props = props @info = [:info] if [:info] @overwrite_type = [:overwrite_type].to_sym if [:overwrite_type] @primary_key = pk end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
6 7 8 |
# File 'lib/bhf/data.rb', line 6 def info @info end |
Instance Method Details
#display_type ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/bhf/data.rb', line 37 def display_type if name === @primary_key :primary_key elsif name === 'updated_at' || name === 'created_at' :date else supported_types(@props.type) end end |
#form_type ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/bhf/data.rb', line 27 def form_type return @overwrite_type if @overwrite_type if name === @primary_key || name === 'updated_at' || name === 'created_at' :static else supported_types(@props.type) end end |
#macro ⇒ Object
17 18 19 |
# File 'lib/bhf/data.rb', line 17 def macro :column end |
#name ⇒ Object
47 48 49 |
# File 'lib/bhf/data.rb', line 47 def name @props.name end |
#type ⇒ Object
21 22 23 24 25 |
# File 'lib/bhf/data.rb', line 21 def type return @overwrite_type if @overwrite_type @props.type end |