String: add truthy? & falsy? core extensions.

* Add `truthy?` and `falsy?` core extensions to String.

* Use `truthy?` and `falsy?` to replace ad-hoc parsing of boolean
  parameters in various places.
This commit is contained in:
evazion
2018-05-03 18:53:35 -05:00
parent 96669ca4b5
commit c7492343ce
15 changed files with 62 additions and 102 deletions

View File

@@ -75,10 +75,6 @@ class TagAliasRequest
end
def skip_secondary_validations=(v)
if v == "1" or v == true or v =~ /t/
@skip_secondary_validations = true
else
@skip_secondary_validations = false
end
@skip_secondary_validations = v.to_s.truthy?
end
end

View File

@@ -75,10 +75,6 @@ class TagImplicationRequest
end
def skip_secondary_validations=(v)
if v == "1" or v == true or v =~ /t/
@skip_secondary_validations = true
else
@skip_secondary_validations = false
end
@skip_secondary_validations = v.to_s.truthy?
end
end