Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Allow anonymous memberless Struct | Jeremy Evans | 2023-04-24 | 1 | -7/+4 |
| | | | | | | | Previously, named memberless Structs were allowed, but anonymous memberless Structs were not. Fixes [Bug #19416] | ||||
* | [Feature #19474] Refactor NEWOBJ macros | Matt Valentine-House | 2023-04-06 | 1 | -1/+1 |
| | | | | NEWOBJ_OF is now our canonical newobj macro. It takes an optional ec | ||||
* | [DOC] Fix broken link Data#deconstruct_keys | Sampat Badhe | 2023-03-08 | 1 | -1/+1 |
| | |||||
* | Fix spelling (#7405) | John Bampton | 2023-02-28 | 1 | -1/+1 |
| | |||||
* | Remove (newly unneeded) remarks about aliases | BurdetteLamar | 2023-02-19 | 1 | -9/+0 |
| | |||||
* | [Bug #19259] `Data#with` should call `initialize` method | Nobuyoshi Nakada | 2023-02-14 | 1 | -17/+6 |
| | |||||
* | Avoid using OBJ_WB_UNPROTECT | Jean Boussier | 2023-02-03 | 1 | -15/+6 |
| | | | | | Not that it makes a big difference here, but it's just unecessary. | ||||
* | [DOC] Fix call-seq of Struct.new (#7246) | Kouhei Yanagita | 2023-02-03 | 1 | -2/+2 |
| | |||||
* | [DOC] Fix call-seq for Data.define | Kouhei Yanagita | 2022-12-28 | 1 | -3/+1 |
| | |||||
* | Docs: Update Struct docs about keyword initialization | zverok | 2022-12-23 | 1 | -16/+31 |
| | |||||
* | Add copy with changes functionality for Data objects (#6766) | Ufuk Kayserilioglu | 2022-12-21 | 1 | -0/+59 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements [Feature #19000] This commit adds copy with changes functionality for `Data` objects using a new method `Data#with`. Since Data objects are immutable, the only way to change them is by creating a copy. This PR adds a `with` method for `Data` class instances that optionally takes keyword arguments. If the `with` method is called with no arguments, the behaviour is the same as the `Kernel#dup` method, i.e. a new shallow copy is created with no field values changed. However, if keyword arguments are supplied to the `with` method, then the copy is created with the specified field values changed. For example: ```ruby Point = Data.define(:x, :y) point = Point.new(x: 1, y: 2) point.with(x: 3) # => #<data Point x: 3, y: 2> ``` Passing positional arguments to `with` or passing keyword arguments to it that do not correspond to any of the members of the Data class will raise an `ArgumentError`. Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> | ||||
* | [Feature #19163] Marshal-loaded Data object also should be frozen | Nobuyoshi Nakada | 2022-12-02 | 1 | -0/+1 |
| | |||||
* | [Feature #19163] Data object should be frozen | Nobuyoshi Nakada | 2022-12-02 | 1 | -1/+11 |
| | |||||
* | Use RTEST and add test for GH-6832 | Alan Wu | 2022-11-30 | 1 | -1/+1 |
| | | | | | Technically we shouldn't see Qfalse now, but RTEST also compiles down to just one branch anyways. Pretty contrived issue, but easy to fix. | ||||
* | struct.c (struct_ivar_get): add conditional for potential Qnil returned by ↵ | Zack Deveau | 2022-11-30 | 1 | -1/+1 |
| | | | | | | | | | rb_class_superclass struct_ivar_get recently started using rb_class_superclass to resolve super instead of RCLASS_SUPER. This change made Qnil a possible case we need to return from within the struct_ivar_get for loop. | ||||
* | Using UNDEF_P macro | S-H-GAMELINKS | 2022-11-16 | 1 | -1/+1 |
| | |||||
* | fix Data docs (#6497) | Yuri Smirnov | 2022-10-06 | 1 | -3/+3 |
| | |||||
* | Cannot `define` from defined `Data` class again | Nobuyoshi Nakada | 2022-10-03 | 1 | -4/+6 |
| | |||||
* | Use the dedicated function to check arity | Nobuyoshi Nakada | 2022-10-01 | 1 | -2/+2 |
| | |||||
* | Fix an out of bound access | Nobuyoshi Nakada | 2022-10-01 | 1 | -0/+6 |
| | |||||
* | Do not define the method only for RDoc | Nobuyoshi Nakada | 2022-10-01 | 1 | -0/+2 |
| | | | | `Data.members` fails an assertion. | ||||
* | Add Data class implementation: Simple immutable value object | Victor Shepelev | 2022-09-30 | 1 | -4/+525 |
| | |||||
* | [DOC] Update `Struct#new` behavior with `keyword_init: true` | Nobuyoshi Nakada | 2022-09-09 | 1 | -3/+4 |
| | |||||
* | Rename rb_ary_tmp_new to rb_ary_hidden_new | Peter Zhu | 2022-07-26 | 1 | -2/+2 |
| | | | | | | rb_ary_tmp_new suggests that the array is temporary in some way, but that's not true, it just creates an array that's hidden and not on the transient heap. This commit renames it to rb_ary_hidden_new. | ||||
* | Expand tabs [ci skip] | Takashi Kokubun | 2022-07-21 | 1 | -179/+179 |
| | | | | [Misc #18891] | ||||
* | Don't attempt to read ivars on T_ICLASS in struct (#5664) | John Hawthorn | 2022-05-26 | 1 | -7/+8 |
| | |||||
* | [ci skip] Fix docs | Peter Zhu | 2022-04-13 | 1 | -6/+6 |
| | |||||
* | Repaired What's Here sections for Range, String, Symbol, Struct (#5735) | Burdette Lamar | 2022-03-30 | 1 | -22/+22 |
| | | | Repaired What's Here sections for Range, String, Symbol, Struct. | ||||
* | A positional Hash is not keyword arguments [Bug #18632] | Nobuyoshi Nakada | 2022-03-17 | 1 | -4/+4 |
| | |||||
* | [DOC] Simplify operator method references | Nobuyoshi Nakada | 2022-02-12 | 1 | -2/+2 |
| | |||||
* | [DOC] Use RDoc link style for links in the same class/module | Peter Zhu | 2022-02-07 | 1 | -7/+7 |
| | | | | | | | | | | I used this regex: (?<=\[)#(?:class|module)-([A-Za-z]+)-label-([A-Za-z0-9\-\+]+) And performed a global find & replace for this: rdoc-ref:$1@$2 | ||||
* | [DOC] Use RDoc link style for links to other classes/modules | Peter Zhu | 2022-02-07 | 1 | -2/+2 |
| | | | | | | | | | | I used this regex: ([A-Za-z]+)\.html#(?:class|module)-[A-Za-z]+-label-([A-Za-z0-9\-\+]+) And performed a global find & replace for this: rdoc-ref:$1@$2 | ||||
* | Improve links to labels in string.c and struct.c (#5531) | Burdette Lamar | 2022-02-06 | 1 | -4/+4 |
| | |||||
* | Initialize Struct by calling with keyword arguments | Nobuyoshi Nakada | 2021-12-26 | 1 | -7/+16 |
| | |||||
* | Fix typos [ci skip] | Kazuhiro NISHIYAMA | 2021-12-25 | 1 | -1/+1 |
| | |||||
* | Fix StructClass:: class method docs | zverok | 2021-12-24 | 1 | -3/+25 |
| | |||||
* | `struct_pos_num` is no longer used | Nobuyoshi Nakada | 2021-11-20 | 1 | -8/+0 |
| | |||||
* | optimize `Struct` getter/setter | Koichi Sasada | 2021-11-19 | 1 | -65/+5 |
| | | | | | Introduce new optimized method type `OPTIMIZED_METHOD_TYPE_STRUCT_AREF/ASET` with index information. | ||||
* | [DOC] Fix code markup [ci skip] | Nobuyoshi Nakada | 2021-10-25 | 1 | -1/+1 |
| | | | | Code markup in RDoc must not be concatenated with anothr word. | ||||
* | Using NIL_P macro instead of `== Qnil` | S.H | 2021-10-03 | 1 | -2/+2 |
| | |||||
* | Enhanced RDoc for Struct (#4895) | Burdette Lamar | 2021-09-27 | 1 | -18/+111 |
| | | | | | | Revises introductory material. Adds section "What's Here". Adds previously missing documentation for method #deconstruct_keys. | ||||
* | Enhanced RDoc for Struct (#4891) | Burdette Lamar | 2021-09-24 | 1 | -46/+109 |
| | | | | | | | | | | | | Treats: #values_at #select #== #hash #eql? #size #dig | ||||
* | Enhanced RDoc for Struct (#4890) | Burdette Lamar | 2021-09-24 | 1 | -63/+107 |
| | | | | | | | | | | | | Treated: #each #each_pair #inspect #to_a #to_h #[] #[]= | ||||
* | Enhance RDoc for Struct (#4885) | Burdette Lamar | 2021-09-23 | 1 | -62/+108 |
| | | | Treats #members and ::new. | ||||
* | [DOC] Fix broken links [ci skip] | Nobuyoshi Nakada | 2021-09-15 | 1 | -1/+1 |
| | | | | | | * As the "doc/" prefix is specified by the `--page-dir` option, remove from the rdoc references. * Refer to the original .rdoc instead of the converted .html. | ||||
* | Using SYMBOL_P macro | S-H-GAMELINKS | 2021-09-11 | 1 | -1/+1 |
| | |||||
* | Make Struct#keyword_init? return nil by default [Feature #18008] | Nobuyoshi Nakada | 2021-07-15 | 1 | -10/+5 |
| | |||||
* | Regularize keyword_init values not to hold the argument object | Nobuyoshi Nakada | 2021-07-15 | 1 | -0/+3 |
| | |||||
* | struct.c: Add keyword_init? singleton method for StructClass (#4609) | hkdnet | 2021-07-15 | 1 | -0/+25 |
| | | | Fixes [Feature #18008] | ||||
* | Warn Struct#initialize with only keyword args (#4070) | Takashi Kokubun | 2021-01-17 | 1 | -7/+15 |
| | | | | | | | | | | | | | | | * Warn Struct#initialize with only keyword args A part of [Feature #16806] * Do not warn if `keyword_init: false` is explicitly specified * Add a NEWS entry * s/in/from/ * Make sure all fields are initialized |