Sha256: 87971bb6b5cfad99707629de89355e44b84c5b7d12f26ab10845bdfbb8870bea

Contents?: true

Size: 722 Bytes

Versions: 4

Compression:

Stored size: 722 Bytes

Contents

/*
  Store elements to Numo::<%=class_name%> from other.
  @overload store(other)
  @param [Object] other
  @return [Numo::<%=class_name%>] self
*/
static VALUE
<%=c_func%>(VALUE self, VALUE obj)
{

    VALUE r;

    <% Store.definitions.each do |x| %>
    if (<%=x.condition%>) {
        <%=x.c_func%>(self,obj);
        return self;
    }
    <% end %>

    if (IsNArray(obj)) {
        r = rb_funcall(obj, rb_intern("coerce_cast"), 1, cT);
        if (CLASS_OF(r)==cT) {
            <%=c_func%>(self,r);
            return self;
        }
    }

    rb_raise(nary_eCastError, "unknown conversion from %s to %s",
             rb_class2name(CLASS_OF(obj)),
             rb_class2name(CLASS_OF(self)));
    return self;
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
numo-narray-0.9.0.4 ext/numo/narray/gen/tmpl_bit/store.c
numo-narray-0.9.0.3-x86-mingw32 ext/numo/narray/gen/tmpl_bit/store.c
numo-narray-0.9.0.3-x64-mingw32 ext/numo/narray/gen/tmpl_bit/store.c
numo-narray-0.9.0.3 ext/numo/narray/gen/tmpl_bit/store.c