Class: NArray
- Inherits:
-
Object
- Object
- NArray
- Defined in:
- lib/narray_yaml.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.yaml_new(klass, tag, val) ⇒ Object
14 15 16 17 18 |
# File 'lib/narray_yaml.rb', line 14 def NArray.yaml_new( klass, tag, val ) na = NArray.new(val["typecode"], *val["shape"]) na[true] = val["ary"] na end |
Instance Method Details
#is_complex_yaml? ⇒ Boolean
31 32 33 |
# File 'lib/narray_yaml.rb', line 31 def is_complex_yaml? true end |
#to_yaml(opts = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/narray_yaml.rb', line 19 def to_yaml(opts={}) YAML::quick_emit( object_id, opts ) do |out| out.map( taguri, to_yaml_style ) do |map| map.add( "typecode", typecode ) map.add( "shape", shape ) map.add( "ary", to_a.flatten ) end end end |
#to_yaml_type ⇒ Object
34 35 36 |
# File 'lib/narray_yaml.rb', line 34 def to_yaml_type "!#{$__yaml_domain__}/#{$__yaml_type__}" end |