Skip to content

Commit

Permalink
Rename object_id to class_object_id to avoid conflict with Ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyObtiva committed Dec 27, 2020
1 parent a7ded1b commit ae786dd
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ puts dump.inspect
# => "{\"_class\":\"Car\",\"_id\":1,\"_instance_variables\":{\"make\":\"Mitsubishi\",\"model\":\"Eclipse\",\"owner\":{\"_class\":\"Person\",\"_id\":1,\"_instance_variables\":{\"dob\":{\"_class\":\"Time\",\"_data\":[0,2458044,50584,0,-14400,2299161.0]},\"name\":\"Sean Hux\"}},\"year\":\"2002\"},\"_classes\":[{\"_class\":\"Person\",\"_class_variables\":{\"class_count\":1},\"_instance_variables\":{\"count\":1}}]}"
```


### Deserialize

[DESERIALIZE NOT FULLY IMPLEMENTED]
Expand Down
4 changes: 2 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

## Next

- Deserialize classes and modules
- Deserialize Struct members as JSON
- Deserialize class variables as JSON
- Deserialize classes and modules
- Support `include_classes` option on load
- Deserialize top-level Class occurence in variables as JSON
- Deserialize top-level Module occurence in variables as JSON
- Deal with bypassing constructor args (perhaps providing an alternative to new)
- Serialize whether a class reference is a class or module
- Materialize a class matching the non-existing class
- Support `include_classes` option on load
- Support passing `whitelist_classes` to filter by upon load

## Soon
Expand Down
1 change: 0 additions & 1 deletion lib/yasl/dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def add_to_classes(object)
classes << object unless classes.include?(object)
end

# TODO rename object_id to something else to avoid conflict with Ruby
def object_id(object)
object_class_array = class_objects[class_for(object)]
object_class_array_index = object_class_array&.index(object)
Expand Down
3 changes: 1 addition & 2 deletions lib/yasl/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def add_to_classes(object)
classes << object unless classes.include?(object)
end

# TODO rename object_id to something else to avoid conflict with Ruby
def object_id(object)
def class_object_id(object)
object_class_array = class_objects[class_for(object)]
object_class_array_index = object_class_array&.index(object)
(object_class_array_index + 1) unless object_class_array_index.nil?
Expand Down

0 comments on commit ae786dd

Please sign in to comment.