Class: ActivityStreams::Verb

Inherits:
Base
  • Object
show all
Defined in:
lib/activitystreams/verb.rb

Defined Under Namespace

Classes: Add, Cancel, Checkin, Delete, Favorite, Follow, Give, Ignore, Invite, Join, Leave, Like, MakeFriend, Play, Post, RSVPMaybe, RSVPNo, RSVPYes, Receive, Remove, RemoveFriend, RequestFriend, Save, Share, StopFollowing, Tag, Unfavorite, Unlike, Unsave, Update

Instance Method Summary collapse

Methods included from Validator

#to_float, #to_integer, #to_iri, #to_time, #validate_attribute!

Constructor Details

#initializeVerb

Returns a new instance of Verb.



5
6
7
8
9
10
11
12
# File 'lib/activitystreams/verb.rb', line 5

def initialize
  _verb_ = if self.class.superclass == Verb
    self.class.name.demodulize.underscore.dasherize
  else
    'post'
  end
  super :verb => _verb_
end

Instance Method Details

#to_s(options = {}) ⇒ Object Also known as: as_json



19
20
21
# File 'lib/activitystreams/verb.rb', line 19

def to_s(options = {})
  verb.to_s
end

#validate_attributes!Object



14
15
16
17
# File 'lib/activitystreams/verb.rb', line 14

def validate_attributes!
  super
  to_iri :verb
end