Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*.rbc
/tmp/
/test/tmp/
Gemfile.lock
.ruby-version
62 changes: 0 additions & 62 deletions Gemfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion lib/dolly/collection.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'delegate'

module Dolly
class Collection < DelegateClass(Array)
class Collection < SimpleDelegator

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no issue with previous versions of ruby with this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It behaves the same and SimpleDelegator is available since ruby 2.4 if I'm not wrong.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this changes rules out some versions of Ruby, then that should be reflected in the version... This should probably be done on a new branch or something as it would be a breaking change for applications using older rubies

attr_reader :options

def initialize(rows: [], options: {})
Expand Down
2 changes: 1 addition & 1 deletion lib/dolly/document_creation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def from_doc(doc)

def from_json(json)
raw_data = Oj.load(json, symbol_keys: true)
data = rails? ? data.with_indifferent_access : raw_data
data = rails? ? raw_data.with_indifferent_access : raw_data
from_doc(data)
end

Expand Down
1 change: 0 additions & 1 deletion lib/dolly/document_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def destroy is_hard = true
def reload
reloaded_doc = self.class.find(id).send(:doc)
attributes = property_clean_doc(reloaded_doc)

attributes.each(&update_attribute)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/dolly/property_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def write_attribute(key, value)
end

def valid_property?(name)
properties.include?(name)
properties.include?(name.to_sym)
end

def update_doc(key, value)
Expand Down
3 changes: 1 addition & 2 deletions lib/dolly/property_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ def <<(property)
end

def [](key)
return detect {|property| property.key == key } if key.is_a?(Symbol)
super
detect {|property| property.key == key.to_sym }
end

private
Expand Down