File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -689,13 +689,24 @@ def self.is_data(a)
689
689
t = Numeric if t < Numeric
690
690
return a . all? { |e | e . kind_of? ( t ) }
691
691
end
692
- elsif defined? ( Numo ::NArray )
692
+ end
693
+ if defined? ( Numo ::NArray )
693
694
return true if a . kind_of? ( Numo ::NArray )
694
- elsif defined? ( ::NArray )
695
+ end
696
+ if defined? ( ::NArray )
695
697
return true if a . kind_of? ( ::NArray )
696
- elsif defined? ( ::NMatrix )
698
+ end
699
+ if defined? ( ::NMatrix )
697
700
return true if a . kind_of? ( ::NMatrix )
698
701
end
702
+ case a [ a . size -1 ] # quick check for unknown data class
703
+ when Numeric
704
+ return true if a [ 0 ] . kind_of? ( Numeric )
705
+ when String
706
+ return true if a [ 0 ] . kind_of? ( String )
707
+ end
708
+ false
709
+ rescue
699
710
false
700
711
end
701
712
@@ -831,7 +842,7 @@ def initialize(*data)
831
842
if data . empty?
832
843
raise ArgumentError , "no data"
833
844
end
834
- @data = data . map { |a | a . flatten }
845
+ @data = data . map { |a | a . respond_to? ( : flatten) ? a . flatten : a }
835
846
@n = @data . map { |a | a . size } . min
836
847
@text = true
837
848
end
You can’t perform that action at this time.
0 commit comments