File tree Expand file tree Collapse file tree 3 files changed +7
-26
lines changed Expand file tree Collapse file tree 3 files changed +7
-26
lines changed Original file line number Diff line number Diff line change @@ -14,21 +14,18 @@ def type
14
14
15
15
def normalize ( value )
16
16
return nil unless value . kind_of? ( String )
17
- if ( value =~ /^file:(.*)/ )
18
- path = $1
19
- return false if not File . exists? ( path ) or File . directory? ( path )
20
- return File . readlines ( path ) . map { |s | s . strip } . join ( " " )
21
- elsif ( value =~ /^rand:(.*)/ )
17
+ if value =~ /^rand:(.*)/
22
18
count = $1. to_i
23
19
return false if count < 1
24
20
ret = ''
25
- count . times {
26
- ret << " " if not ret . empty?
27
- ret << [ rand ( 0x100000000 ) ] . pack ( "N" ) . unpack ( "C*" ) . map { |x | x . to_s } . join ( "." )
28
- }
21
+ count . times do
22
+ ret << ' ' if not ret . empty?
23
+ ret << [ rand ( 0x100000000 ) ] . pack ( 'N' ) . unpack ( 'C*' ) . map { |x | x . to_s } . join ( '.' )
24
+ end
29
25
return ret
30
26
end
31
- return value
27
+
28
+ value
32
29
end
33
30
34
31
def valid? ( value )
Original file line number Diff line number Diff line change @@ -13,14 +13,6 @@ def type
13
13
end
14
14
15
15
def normalize ( value )
16
- if ( value =~ /^file:(.*)/ )
17
- path = $1
18
- begin
19
- value = File . read ( path )
20
- rescue ::Errno ::ENOENT , ::Errno ::EISDIR
21
- value = nil
22
- end
23
- end
24
16
value
25
17
end
26
18
Original file line number Diff line number Diff line change @@ -13,14 +13,6 @@ def type
13
13
end
14
14
15
15
def normalize ( value )
16
- if ( value =~ /^file:(.*)/ )
17
- path = $1
18
- begin
19
- value = File . read ( path )
20
- rescue ::Errno ::ENOENT , ::Errno ::EISDIR
21
- value = nil
22
- end
23
- end
24
16
value
25
17
end
26
18
You can’t perform that action at this time.
0 commit comments