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

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

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

#nowObject

Utility method for returning the current time



144
145
146
# File 'lib/streams/activitystreams.rb', line 144

def now
  Time.now.utc
end

#object(object_type = nil, &block) ⇒ Object

Create a new Activity Streams Object



124
125
126
# File 'lib/streams/activitystreams.rb', line 124

def object(object_type=nil,&block)
  ASObj.generate object_type,&block
end