6b3be72395
git-svn-id: svn://atos.wmid.amu.edu.pl/utt@41 e293616e-ec6a-49c2-aa92-f4a8b91c5d16
32 lines
343 B
Ruby
32 lines
343 B
Ruby
|
|
class Seg
|
|
|
|
def initialize(s="")
|
|
@line=s
|
|
self
|
|
end
|
|
|
|
def to_s
|
|
@line.chomp
|
|
end
|
|
|
|
def set(s)
|
|
@line=s
|
|
self
|
|
end
|
|
|
|
def field(key)
|
|
if key.class==Fixnum
|
|
@line.split[key-1]
|
|
elsif key.class==String
|
|
@line =~ /\s#{key}:(\S+)/; $1
|
|
end
|
|
end
|
|
alias [] field
|
|
|
|
def fields
|
|
@line.split
|
|
end
|
|
|
|
end
|