Class: Iron::Field
Defined Under Namespace
Modules: BelongsToEntry, LengthConstrained, Validatable
Constant Summary
collapse
- TYPES =
%w[text_field text_area rich_text_area number file boolean date block block_list reference_list reference].freeze
- CONTENT_MISSING =
Object.new.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
#filled?
Class Method Details
.content_fetch(hash, handle) ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'app/models/iron/field.rb', line 14
def self.content_fetch(hash, handle)
if hash.key?(handle)
hash[handle]
elsif hash.key?(handle.to_sym)
hash[handle.to_sym]
else
CONTENT_MISSING
end
end
|
Instance Method Details
#content_value=(value) ⇒ Object
24
25
26
|
# File 'app/models/iron/field.rb', line 24
def content_value=(value)
raise NotImplementedError, "#{type} must implement content_value="
end
|
#export_attachments ⇒ Object
44
45
46
|
# File 'app/models/iron/field.rb', line 44
def export_attachments
[]
end
|
#export_value ⇒ Object
40
41
42
|
# File 'app/models/iron/field.rb', line 40
def export_value
raise "Field type '#{type}' export_value method not supported"
end
|
#searchable_text ⇒ Object
32
33
34
|
# File 'app/models/iron/field.rb', line 32
def searchable_text
nil
end
|
#type_handle ⇒ Object
28
29
30
|
# File 'app/models/iron/field.rb', line 28
def type_handle
type.demodulize.underscore
end
|
#value ⇒ Object
36
37
38
|
# File 'app/models/iron/field.rb', line 36
def value
raise "Field type '#{type}' value method not supported"
end
|