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
    def self.from_string(str)
      case str
        when /<.+>/
          m, name, email = *str.match(/(.*) <(.+?)>/)
          return self.new(name, email)
        else
          return self.new(str, nil)
      end
    end

[Source]

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

Public Instance methods

Pretty object inspection

[Source]

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

[Validate]