diff options
| author | Teddy Wing | 2017-06-09 15:44:16 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-06-09 15:44:16 +0200 |
| commit | 8674d00185602c76b5231282ac87ea746ab1a2f2 (patch) | |
| tree | 2a24fcd99e06912eff6c6ec5bf257f730700cf9e | |
| parent | 31805920c4ec9366d37a6b00d3dc8e48db72ea9f (diff) | |
| download | chouette-core-8674d00185602c76b5231282ac87ea746ab1a2f2.tar.bz2 | |
TableBuilderHelper: Use `#is_a?` instead of `==` for type checking
Prefer `#is_a?` which is there specifically for type checking instead of
`==` to compare types.
Refs #3479
| -rw-r--r-- | app/helpers/table_builder_helper.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb index 95c84d50e..83c7a0689 100644 --- a/app/helpers/table_builder_helper.rb +++ b/app/helpers/table_builder_helper.rb @@ -77,15 +77,14 @@ module TableBuilderHelper if attribute == 'name' || attribute == 'comment' lnk = [] - # #is_a? ? ; or ? - unless item.class == Calendar || item.class == Referential + unless item.is_a?(Calendar) || item.is_a?(Referential) if current_referential lnk << current_referential lnk << item.line if item.respond_to? :line - lnk << item.route.line if item.class == Chouette::RoutingConstraintZone + lnk << item.route.line if item.is_a?(Chouette::RoutingConstraintZone) lnk << item if item.respond_to? :line_referential lnk << item.stop_area if item.respond_to? :stop_area - lnk << item if item.respond_to? :stop_points || item.class.to_s == 'Chouette::TimeTable' + lnk << item if item.respond_to? :stop_points || item.is_a?(Chouette::TimeTable) elsif item.respond_to? :referential lnk << item.referential end @@ -120,14 +119,14 @@ module TableBuilderHelper polymorph_url << action end - unless item.class == Calendar || item.class == Referential + unless item.is_a?(Calendar) || item.is_a?(Referential) if current_referential polymorph_url << current_referential polymorph_url << item.line if item.respond_to? :line - polymorph_url << item.route.line if item.class == Chouette::RoutingConstraintZone + polymorph_url << item.route.line if item.is_a?(Chouette::RoutingConstraintZone) polymorph_url << item if item.respond_to? :line_referential polymorph_url << item.stop_area if item.respond_to? :stop_area - polymorph_url << item if item.respond_to? :stop_points || item.class.to_s == 'Chouette::TimeTable' + polymorph_url << item if item.respond_to? :stop_points || item.is_a?(Chouette::TimeTable) elsif item.respond_to? :referential polymorph_url << item.referential end |
