diff options
| author | Teddy Wing | 2017-07-07 16:36:51 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-07-12 11:06:03 +0200 | 
| commit | d4be863478181b126faaafe25cfb293dca058570 (patch) | |
| tree | 66d4a5aaf02c4c63a118cc6af700d6ab784bad1b /spec/helpers | |
| parent | cdf5854f9a7b52f7b9f2607796d0dff90d04f6e4 (diff) | |
| download | chouette-core-d4be863478181b126faaafe25cfb293dca058570.tar.bz2 | |
TableBuilderHelper: Move `referential` variable to method
At Robert's recommendation, use `try` instead of `respond_to?` because
it's shorter.
Also at Robert's recommendation, move the `referential` variable to a
method to memoize it. This allows us to use it in other places without
re-getting it and without having to do the `if` check again.
He had suggested:
    def referential
      return @__referential__ if instance_variable_defined?(:@__referential__)
      @__referential__ = try(:current_referential)
    end
but I think the `||=` version works the same way and is shorter. Still
need to find out from him what our style guide rules for __variables__
are and why I should be using one here.
Refs #3479
Diffstat (limited to 'spec/helpers')
0 files changed, 0 insertions, 0 deletions
