Skip to content

Commit

Permalink
Merge pull request #4 from bdurand/freeze-values
Browse files Browse the repository at this point in the history
Freeze values returned by helper methods.
  • Loading branch information
bdurand authored May 1, 2023
2 parents b84deb7 + 6d8b1ea commit 9979aae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.1.1

- Freeze values returned from helper methods.

## 1.1.0

### Added
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
1.1.1
2 changes: 1 addition & 1 deletion lib/support_table_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def define_support_table_instance_attribute_helper(method_name, attribute_value)

class_eval <<~RUBY, __FILE__, __LINE__ + 1
def self.#{method_name}
#{attribute_value.inspect}
#{attribute_value.inspect}.freeze
end
RUBY
end
Expand Down
5 changes: 5 additions & 0 deletions spec/support_table_data_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@
expect(Group.support_table_attribute_helpers).to match_array ["group_id", "name"]
expect(Color.support_table_attribute_helpers).to match_array []
end

it "returns frozen values" do
expect(Group.primary_group_id).to be_frozen
expect(Group.primary_name).to be_frozen
end
end

describe "protected_instance?" do
Expand Down

0 comments on commit 9979aae

Please sign in to comment.