Module: Deplate::Names

Included in:
Command
Defined in:
lib/deplate/commands.rb

Overview

commands.rb @Author: Thomas Link (micathom AT gmail com) @Website: deplate.sf.net/ @License: GPL (see www.gnu.org/licenses/gpl.txt) @Created: 08-Mai-2004. @Revision: 0.1315

Class Method Summary collapse

Class Method Details

.name_match_c(text) ⇒ Object



12
13
14
15
16
# File 'lib/deplate/commands.rb', line 12

def name_match_c(text)
    if text =~ /^\{(.*)\}$/
        return {:surname => $1}
    end
end

.name_match_fs(text) ⇒ Object



23
24
25
26
# File 'lib/deplate/commands.rb', line 23

def name_match_fs(text)
    m = /^\s*(\S+(\s+\S+)*?)\s+(\S+)\s*$/.match(text)
    return m ? {:firstname => m[1], :surname => m[3]} : nil
end

.name_match_sf(text) ⇒ Object



18
19
20
21
# File 'lib/deplate/commands.rb', line 18

def name_match_sf(text)
    m = /^\s*(.+?),\s*(.+?)\s*$/.match(text)
    return m ? {:firstname => m[2], :surname => m[1]} : nil
end