Class: DataKitten::Agent

Inherits:
Object
  • Object
show all
Defined in:
lib/data_kitten/agent.rb

Overview

A person or organisation.

Naming is based on foaf:Agent, but with useful aliases for other vocabularies.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Agent

Create a new Agent

Parameters:

  • options (Hash)

    the details of the Agent.

Options Hash (options):

  • :name (String)

    The Agent’s name

  • :homepage (String)

    The homepage URL for the Agent

  • :mbox (String)

    Email address for the Agent



15
16
17
18
19
# File 'lib/data_kitten/agent.rb', line 15

def initialize(options)
  @name = options[:name]
  @homepage = options[:homepage]
  @mbox = options[:mbox]
end

Instance Attribute Details

#homepageString Also known as: url, uri

Returns the homepage URL of the Agent.

Returns:

  • (String)

    the homepage URL of the Agent



27
28
29
# File 'lib/data_kitten/agent.rb', line 27

def homepage
  @homepage
end

#mboxString Also known as: email

Returns the email address of the Agent.

Returns:

  • (String)

    the email address of the Agent



33
34
35
# File 'lib/data_kitten/agent.rb', line 33

def mbox
  @mbox
end

#nameString

Returns the name of the Agent.

Returns:

  • (String)

    the name of the Agent



23
24
25
# File 'lib/data_kitten/agent.rb', line 23

def name
  @name
end

Instance Method Details

#==(agent) ⇒ Object



36
37
38
# File 'lib/data_kitten/agent.rb', line 36

def ==(agent)
  agent.is_a?(Agent) && ([name, homepage, mbox] == [agent.name, agent.homepage, agent.mbox])
end