Skip to content

Commit

Permalink
fixed rubocop offense, slightly increased max classlength
Browse files Browse the repository at this point in the history
  • Loading branch information
SidOfc committed Apr 29, 2017
1 parent a8dc6dd commit 7d32075
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Metrics/AbcSize:

Metrics/ClassLength:
CountComments: false
Max: 150
Max: 175

Metrics/MethodLength:
CountComments: false
Expand Down
14 changes: 12 additions & 2 deletions lib/browserino/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def to_json(*args)
def to_s
@str_cache ||= %i[name engine platform].map do |prop|
n = properties[prop]
v = properties[prop == :name ? :version : "#{prop}_version".to_sym]
l = properties[prop == :name ? :label : "#{prop}_label".to_sym]
v = version_for prop
l = label_for prop
a = l ? l : [n, (v.major if v > '0.0.0')].join.to_sym

[n, a].uniq
Expand Down Expand Up @@ -140,6 +140,16 @@ def respond_to_missing?(_, *__, &___)

private

def name_for(sym)
mtd = %i[version label].include?(sym) ? :name : "#{sym}_name".to_sym
properties[mtd]
end

def label_for(sym)
mtd = %i[version name].include?(sym) ? :label : "#{sym}_label".to_sym
properties[mtd]
end

def version_for(sym)
mtd = %i[label name].include?(sym) ? :version : "#{sym}_version".to_sym
properties[mtd]
Expand Down

0 comments on commit 7d32075

Please sign in to comment.