Sha256: 4677d87965be5adbb2e3514792f08896191d2ffe90578b694e8b6fef146a13d5
Contents?: true
Size: 748 Bytes
Versions: 41
Compression:
Stored size: 748 Bytes
Contents
module Grit class Actor attr_reader :name attr_reader :email def initialize(name, email) @name = name @email = email end alias_method :to_s, :name # 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 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 # Pretty object inspection def inspect %Q{#<Grit::Actor "#{@name} <#{@email}>">} end end # Actor end # Grit
Version data entries
41 entries across 41 versions & 16 rubygems