lib/scrivito/basic_widget.rb in scrivito_sdk-1.5.5 vs lib/scrivito/basic_widget.rb in scrivito_sdk-1.6.0.rc1
- old
+ new
@@ -140,11 +140,12 @@
# @param [Hash] attributes for the new widget
# @param [Hash] context in which the object creating should happen
# @option context [Scrivito::User] :scrivito_user current visitor
# @return [Widget] the newly created {Scrivito::BasicWidget Widget}
#
- # @see Scrivito::BasicWidget.new
+ # @raise [ArgumentError] if called on +Widget+ without +_obj_class+ attribute.
+ #
# @see Scrivito::AttributeContent::ClassMethods#default_for
#
def self.new(attributes = {}, context = {})
if obj_class = extract_obj_class_from_attributes(attributes)
obj_class.new(attributes, context)
@@ -317,11 +318,12 @@
else
super
end
end
- # Returns the entity ({Scrivito::BasicObj} or {Scrivito::BasicWidget}) that references this widget.
+ # Returns the entity ({Scrivito::BasicObj} or {Scrivito::BasicWidget})
+ # that references this widget.
# @api public
#
# @return [Scrivito::AttributeContent] the entity that references this widget.
def container
@container || container_and_attribute_name.first
@@ -363,9 +365,13 @@
else
"<#{self.class}>"
end
end
+ # Returns the {Scrivito::BasicObj Obj} to which this widget belongs.
+ # @api public
+ #
+ # @return [Scrivito::BasicObj] - the Obj this widget belongs to.
def obj
if @obj
@obj
else
raise_not_persisted_error