Module: ActivityStreams

Includes:
Makers, Matchers
Included in:
Experimental
Defined in:
lib/streams/activitystreams.rb

Defined Under Namespace

Modules: AVSpec, ActivitySpec, AddressSpec, BinarySpec, BookmarkSpec, CollectionSpec, EventSpec, Experimental, FileSpec, ImageSpec, IssueSpec, LinkSpec, LinksSpec, Makers, Matchers, MediaLinkSpec, MoodSpec, ObjectSpec, PermissionsSpec, PlaceSpec, PositionSpec, RGSpec, Spec, TaskSpec Classes: ASObj

Constant Summary collapse

SPECS =

Collect the various Specs and map to their respective object types

{
  nil         => ObjectSpec,
  :activity   => ActivitySpec,
  :media_link => MediaLinkSpec,
  :mood       => MoodSpec,
  :address    => AddressSpec,
  :place      => PlaceSpec,
  :position   => PositionSpec,
  :collection => CollectionSpec,
  :audio      => AVSpec,
  :video      => AVSpec,
  :binary     => BinarySpec,
  :file       => FileSpec,
  :event      => EventSpec,
  :issue      => IssueSpec,
  :permission => PermissionsSpec,
  :role       => RGSpec,
  :group      => RGSpec,
  :task       => TaskSpec,
  :product    => ImageSpec,
  :image      => ImageSpec,
  :link       => LinkSpec,
  :links      => LinksSpec
}

Class Method Summary collapse

Methods included from Makers

#activity, #collection, #copy_from, #media_link, #now, #object

Methods included from Matchers

is_absolute_iri?, is_lang_tag?, is_mime_type?, is_token?, is_verb?

Class Method Details

.add_spec(sym, spec) ⇒ Object

override or add a new spec… be careful here.. the existing spec definitions can be overridden



953
954
955
# File 'lib/streams/activitystreams.rb', line 953

def add_spec sym, spec 
  SPECS[sym] = spec
end

.checker(&block) ⇒ Object



187
188
189
# File 'lib/streams/activitystreams.rb', line 187

def checker &block
  Matchers.checker &block
end

.object_spec(*specs, &block) ⇒ Object

create a new Spec module based on ObjectSpec



965
966
967
# File 'lib/streams/activitystreams.rb', line 965

def object_spec *specs, &block
  spec ObjectSpec, *specs, &block
end

.spec(*specs, &block) ⇒ Object

create a new Spec module



958
959
960
961
962
# File 'lib/streams/activitystreams.rb', line 958

def spec *specs, &block
  o = Module.new.extend Spec, Spec::Defs, *specs
  o.module_exec &block
  o
end