Sha256: 7b054b8e064bedaa4b8f35493ca6e7474627e0fe97a3e6f056230ab98daccf19

Contents?: true

Size: 904 Bytes

Versions: 1

Compression:

Stored size: 904 Bytes

Contents

<% children.each do |c|%>
<%= c.result %>

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

    klass = CLASS_OF(obj);

    <% definitions.each do |x| %>
    if (<%=x.condition("klass")%>) {
        <%=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;
        }
    }

    <% if is_object %>
    robject_store_numeric(self,obj);
    <% else %>
    rb_raise(nary_eCastError, "unknown conversion from %s to %s",
             rb_class2name(CLASS_OF(obj)),
             rb_class2name(CLASS_OF(self)));
    <% end %>
    return self;
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cumo-0.1.0 ext/cumo/narray/gen/tmpl/store.c