Class: CArray::Inspector
- Inherits:
-
Object
- Object
- CArray::Inspector
- Defined in:
- lib/carray/base/inspect.rb
Overview
carray/base/inspect.rb
This file is part of Ruby/CArray extension library.
You can redistribute it and/or modify it under the terms of
the Ruby Licence.
Copyright (C) 2005 Hiroki Motoyoshi
Instance Method Summary collapse
-
#initialize(carray) ⇒ Inspector
constructor
:nodoc:.
- #inspect_string ⇒ Object
Constructor Details
#initialize(carray) ⇒ Inspector
:nodoc:
15 16 17 |
# File 'lib/carray/base/inspect.rb', line 15 def initialize (carray) @carray = carray end |
Instance Method Details
#inspect_string ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/carray/base/inspect.rb', line 19 def inspect_string if @carray.rank == 0 raise "can't inspect CArray of rank == 0" end formatter = get_formatter() class_name = get_class_name() type_name = get_type_name() shape = get_shape() data_spec = get_data_spec(0, Array.new(@carray.rank){0}, formatter) info_list = get_info_list() output = ["<", format("%s.%s(%s)", class_name, type_name, shape.join(",")), ": ", info_list.join(" "), "\n", data_spec, ">" ].join if @carray.tainted? output.taint end return output end |