Class Grit::Actor
In: lib/grit/actor.rb
Parent: Object

Methods

from_string   inspect   new  

External Aliases

name -> to_s

Attributes

email  [R] 
name  [R] 

Public Class methods

Create an Actor from a string.

  +str+ is the string, which is expected to be in regular git format

Format

  John Doe <jdoe@example.com>

Returns Actor

[Source]

    # File lib/grit/actor.rb, line 20
20:     def self.from_string(str)
21:       case str
22:         when /<.+>/
23:           m, name, email = *str.match(/(.*) <(.+?)>/)
24:           return self.new(name, email)
25:         else
26:           return self.new(str, nil)
27:       end
28:     end

[Source]

    # File lib/grit/actor.rb, line 7
 7:     def initialize(name, email)
 8:       @name = name
 9:       @email = email
10:     end

Public Instance methods

Pretty object inspection

[Source]

    # File lib/grit/actor.rb, line 31
31:     def inspect
32:       %Q{#<Grit::Actor "#{@name} <#{@email}>">}
33:     end

[Validate]