Module: ActivityStreams::Makers
- Included in:
- ActivityStreams, ASObj
- Defined in:
- lib/streams/activitystreams.rb
Overview
Defines the basic functions for the Activity Streams DSL
Instance Method Summary collapse
-
#activity(include_object_type = false, &block) ⇒ Object
Create a new Activity Object.
-
#collection(include_object_type = false, &block) ⇒ Object
Create a new Collection Object.
-
#copy_from(other, *without, &block) ⇒ Object
Create a new object by copying another.
-
#media_link(&block) ⇒ Object
Create a new Media Link.
-
#now ⇒ Object
Utility method for returning the current time.
-
#object(object_type = nil, &block) ⇒ Object
Create a new Activity Streams Object.
Instance Method Details
#activity(include_object_type = false, &block) ⇒ Object
Create a new Activity Object
139 140 141 |
# File 'lib/streams/activitystreams.rb', line 139 def activity include_object_type=false, &block ASObj.generate :activity, !include_object_type, &block end |
#collection(include_object_type = false, &block) ⇒ Object
Create a new Collection Object
134 135 136 |
# File 'lib/streams/activitystreams.rb', line 134 def collection include_object_type=false, &block ASObj.generate :collection, !include_object_type, &block end |
#copy_from(other, *without, &block) ⇒ Object
Create a new object by copying another. A list of properties to omit from the new copy can be provided a variable arguments. For instance, if you have an existing activity object and wish to copy everything but the current verb and actor properties, you could call new_act = copy_from(old_act, :verb, :actor) { … }
119 120 121 |
# File 'lib/streams/activitystreams.rb', line 119 def copy_from(other,*without,&block) ASObj.from other,*without,&block end |
#media_link(&block) ⇒ Object
Create a new Media Link
129 130 131 |
# File 'lib/streams/activitystreams.rb', line 129 def media_link &block ASObj.generate :media_link,true,&block end |
#now ⇒ Object
Utility method for returning the current time
144 145 146 |
# File 'lib/streams/activitystreams.rb', line 144 def now Time.now.utc end |