Class: Panko::Association
- Inherits:
-
Object
- Object
- Panko::Association
- Defined in:
- lib/panko/association.rb,
ext/panko_serializer/serialization_descriptor/association.c
Class Method Summary collapse
Instance Method Summary collapse
- #descriptor ⇒ Object
- #descriptor=(descriptor) ⇒ Object
- #duplicate ⇒ Object
- #inspect ⇒ Object
- #name_str ⇒ Object
- #name_sym ⇒ Object
Class Method Details
.new(*args) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'ext/panko_serializer/serialization_descriptor/association.c', line 33
static VALUE association_new(int argc, VALUE* argv, VALUE self) {
Association association;
Check_Type(argv[0], T_SYMBOL);
Check_Type(argv[1], T_STRING);
association = ALLOC(struct _Association);
association->name_sym = argv[0];
association->name_str = argv[1];
association->rb_descriptor = argv[2];
association->name_id = rb_intern_str(rb_sym2str(association->name_sym));
association->descriptor = sd_read(association->rb_descriptor);
return Data_Wrap_Struct(cAssociation, association_mark, association_free,
association);
}
|
Instance Method Details
#descriptor ⇒ Object
65 66 67 68 |
# File 'ext/panko_serializer/serialization_descriptor/association.c', line 65
VALUE association_descriptor_ref(VALUE self) {
Association association = (Association)DATA_PTR(self);
return association->rb_descriptor;
}
|
#descriptor=(descriptor) ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'ext/panko_serializer/serialization_descriptor/association.c', line 70
VALUE association_decriptor_aset(VALUE self, VALUE descriptor) {
Association association = (Association)DATA_PTR(self);
association->rb_descriptor = descriptor;
association->descriptor = sd_read(descriptor);
return association->rb_descriptor;
}
|
#duplicate ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/panko/association.rb', line 5 def duplicate Panko::Association.new( name_sym, name_str, Panko::SerializationDescriptor.duplicate(descriptor) ) end |
#inspect ⇒ Object
13 14 15 |
# File 'lib/panko/association.rb', line 13 def inspect "<Panko::Association name=#{name_str.inspect}>" end |
#name_str ⇒ Object
60 61 62 63 |
# File 'ext/panko_serializer/serialization_descriptor/association.c', line 60
VALUE association_name_str_ref(VALUE self) {
Association association = (Association)DATA_PTR(self);
return association->name_str;
}
|
#name_sym ⇒ Object
55 56 57 58 |
# File 'ext/panko_serializer/serialization_descriptor/association.c', line 55
VALUE association_name_sym_ref(VALUE self) {
Association association = (Association)DATA_PTR(self);
return association->name_sym;
}
|