module RailsConnector::Meta
Public Class Methods
This method is an equivalent of Rails.logger.silence, which has been deprecated
# File lib/reactor/rails_connector_meta.rb, line 6 def self.hello_im_rails_and_im_retarted_so_please_be_patient(&block) begin old_logger_level, Rails.logger.level = Rails.logger.level, Logger::ERROR yield self ensure Rails.logger.level = old_logger_level end end
Public Instance Methods
# File lib/reactor/rails_connector_meta.rb, line 107 def committed? load_meta_details !@object_with_meta_data.committed_cont_id.nil? end
Returns true, if the file format has an attribute of the given name.
# File lib/reactor/rails_connector_meta.rb, line 40 def custom_attribute?(attr) self.obj_class_definition.custom_attribute?(attr) end
Returns the custom attributes in the form of a Hash.
# File lib/reactor/rails_connector_meta.rb, line 35 def custom_attributes self.obj_class_definition.custom_attributes end
Return the current editor as a String. If there is no edited content, which is always the case in live mode, an empty String is returned. The 'contents' table is queried for this information.
# File lib/reactor/rails_connector_meta.rb, line 88 def editor return @editor if @editor load_meta_details content_id = if self.edited? @object_with_meta_data.edited_content_id else @object_with_meta_data.released_cont_id end if content_id content = RailsConnector::Content.find(content_id) @editor = content.editor else @editor = '' end end
Returns true, if there is a custom Ruby class defined for the object or false, if it is represented by RailsConnector::Obj
# File lib/reactor/rails_connector_meta.rb, line 30 def has_custom_ruby_class? self.class.is_custom_ruby_class? end
Returns true, if the file format has an mandatory attribute of the given name.
# File lib/reactor/rails_connector_meta.rb, line 55 def mandatory_attribute?(attr) self.obj_class_definition.mandatory_attribute?(attr) end
Returns an Array of String of all mandatory attributes, no mather if it's custom or built-in. Built-in attributes are underscored (valid_from, not validFrom). Possible options
are:
:only_custom_attributes
-
Return only custom attributes, omit
built-in attributes like content_type or valid_from.
# File lib/reactor/rails_connector_meta.rb, line 50 def mandatory_attribute_names(options = {}) self.obj_class_definition.mandatory_attribute_names(options) end
The RailsConnector::ObjClass object for this file format. This will always return a proper object, even if no custom Ruby class exists.
# File lib/reactor/rails_connector_meta.rb, line 23 def obj_class_definition @obj_class_definition ||= RailsConnector::Meta::EagerLoader.instance.obj_class(self.obj_class) end
Returns the reminder comment, if a reminder is set.
# File lib/reactor/rails_connector_meta.rb, line 74 def reminder_comment load_meta_details @object_with_meta_data.reminder_comment end
Returns the time of the reminder, if it is set.
# File lib/reactor/rails_connector_meta.rb, line 67 def reminder_from load_meta_details @object_with_meta_data.reminder_from.presence && ::RailsConnector::DateAttribute.parse(@object_with_meta_data.reminder_from) end
Returns the version of this object. This number is increased every time this object is released.
# File lib/reactor/rails_connector_meta.rb, line 61 def version load_meta_details @object_with_meta_data.version.presence.to_i || 0 end
Return the name of the workflow, that is assigned to this object.
# File lib/reactor/rails_connector_meta.rb, line 80 def workflow_name load_meta_details @object_with_meta_data.workflow_name end