module Aliyun::Log::Record::Field
Constants
- DEFAULT_INDEX_TOKEN
- PERMITTED_KEY_TYPES
Types allowed in indexes:
Attributes
attributes[RW]
Public Instance Methods
attribute_names()
click to toggle source
# File lib/aliyun/log/record/field.rb, line 94 def attribute_names @attributes.keys end
evaluate_default_value(val)
click to toggle source
# File lib/aliyun/log/record/field.rb, line 102 def evaluate_default_value(val) if val.respond_to?(:call) val.call elsif val.duplicable? val.dup else val end end
has_attribute?(attr_name)
click to toggle source
# File lib/aliyun/log/record/field.rb, line 98 def has_attribute?(attr_name) @attributes.key?(attr_name.to_sym) end
read_attribute(name)
click to toggle source
# File lib/aliyun/log/record/field.rb, line 120 def read_attribute(name) attributes[name.to_sym] end
Also aliased as: []
set_created_at()
click to toggle source
# File lib/aliyun/log/record/field.rb, line 125 def set_created_at self.created_at ||= DateTime.now.in_time_zone(Time.zone).iso8601 if timestamps_enabled? end
timestamps_enabled?()
click to toggle source
# File lib/aliyun/log/record/field.rb, line 129 def timestamps_enabled? self.class.options[:timestamps] || (self.class.options[:timestamps].nil? && Config.timestamps) end
write_attribute(name, value)
click to toggle source
# File lib/aliyun/log/record/field.rb, line 114 def write_attribute(name, value) attributes[name.to_sym] = TypeCasting.cast_field(value, self.class.attributes[name.to_sym]) end
Also aliased as: []=