File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,7 +88,13 @@ def self.each(&block)
8888 # @yieldreturn [String] another way to provide a sample, allows lazy for retrieving the sample.
8989 #
9090 # @return [Class]
91- def self . for ( arg , &block )
91+ def self . for ( *arg , &block )
92+ case arg . length
93+ when 0 then arg = nil
94+ when 1 then arg = arg . first
95+ else
96+ raise ArgumentError , "Format.for accepts zero or one argument, got #{ arg . length } ."
97+ end
9298 arg = arg . merge ( has_reader : true ) if arg . is_a? ( Hash )
9399 if format = self . format || Format . for ( arg , &block )
94100 format . reader
Original file line number Diff line number Diff line change @@ -89,9 +89,15 @@ def self.each(&block)
8989 # @return [Class]
9090 #
9191 # @return [Class]
92- def self . for ( options = { } )
93- options = options . merge ( has_writer : true ) if options . is_a? ( Hash )
94- if format = self . format || Format . for ( options )
92+ def self . for ( *arg , &block )
93+ case arg . length
94+ when 0 then arg = nil
95+ when 1 then arg = arg . first
96+ else
97+ raise ArgumentError , "Format.for accepts zero or one argument, got #{ arg . length } ."
98+ end
99+ arg = arg . merge ( has_writer : true ) if arg . is_a? ( Hash )
100+ if format = self . format || Format . for ( arg )
95101 format . writer
96102 end
97103 end
You can’t perform that action at this time.
0 commit comments