Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :condition option for .memoize method #7

Merged
merged 1 commit into from
Aug 31, 2018

Conversation

AlexWayfer
Copy link
Contributor

@AlexWayfer AlexWayfer commented Aug 27, 2018

Now you can specify a block for instance execute
whether to use memoization or not:

def file_mtime
  File.mtime asset_file
end

memoize :file_mtime, condition: -> { environment == 'production' }

It's useful for AlexWayfer/flame#22 (the branch is ready).

Now you can specify a block for instance execute
whether to use memoization or not:

```ruby
def file_mtime
  File.mtime asset_file
end

memoize :file_mtime, condition: -> { environment == 'production' }
```
@coveralls
Copy link

coveralls commented Aug 27, 2018

Pull Request Test Coverage Report for Build 21

  • 25 of 25 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 20: 0.0%
Covered Lines: 153
Relevant Lines: 153

💛 - Coveralls

@tycooon tycooon merged commit c64db6c into tycooon:master Aug 31, 2018
@tycooon
Copy link
Owner

tycooon commented Aug 31, 2018

Thanks for the PR!

@tycooon
Copy link
Owner

tycooon commented Aug 31, 2018

By the way, if you can add some docs to the Readme – that would be very nice.

@AlexWayfer AlexWayfer deleted the add_condition_option branch August 31, 2018 13:22
@AlexWayfer
Copy link
Contributor Author

By the way, if you can add some docs to the Readme – that would be very nice.

Yeah, sorry, I forgot about this. Done in #8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants