Class: Oversee::Field::Value
- Defined in:
- app/components/oversee/field/value.rb
Direct Known Subclasses
BelongsTo, Boolean, Date, Datetime, Enum, Integer, Json, RichText, String, Text
Defined Under Namespace
Classes: BelongsTo, Boolean, Date, Datetime, Enum, Integer, Json, RichText, String, Text
Constant Summary collapse
- MAP =
{ string: Oversee::Field::Value::String, belongs_to: Oversee::Field::Value::BelongsTo, boolean: Oversee::Field::Value::Boolean, date: Oversee::Field::Value::Date, datetime: Oversee::Field::Value::Datetime, enum: Oversee::Field::Value::Enum, integer: Oversee::Field::Value::Integer, json: Oversee::Field::Value::Json, jsonb: Oversee::Field::Value::Json, rich_text: Oversee::Field::Value::RichText, text: Oversee::Field::Value::Text, }
Instance Attribute Summary collapse
-
#datatype ⇒ Object
readonly
Returns the value of attribute datatype.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(key: nil, value: nil, datatype: :string, **options) ⇒ Value
constructor
A new instance of Value.
- #view_template ⇒ Object
Constructor Details
#initialize(key: nil, value: nil, datatype: :string, **options) ⇒ Value
Returns a new instance of Value.
20 21 22 23 24 25 26 27 |
# File 'app/components/oversee/field/value.rb', line 20 def initialize(key: nil, value: nil, datatype: :string, **) @key = key @value = value @datatype = datatype @options = @class = @options[:class] end |
Instance Attribute Details
#datatype ⇒ Object (readonly)
Returns the value of attribute datatype.
18 19 20 |
# File 'app/components/oversee/field/value.rb', line 18 def datatype @datatype end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
16 17 18 |
# File 'app/components/oversee/field/value.rb', line 16 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
17 18 19 |
# File 'app/components/oversee/field/value.rb', line 17 def value @value end |
Instance Method Details
#view_template ⇒ Object
29 30 31 32 |
# File 'app/components/oversee/field/value.rb', line 29 def view_template return p(class: "text-gray-400 text-xs"){ "—" } if value.nil? render component_class.new(key:, value:, **@options) end |