Skip to content

Commit

Permalink
Manual refactoring/clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Jun 9, 2016
1 parent 1197099 commit 364a46f
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 34 deletions.
6 changes: 1 addition & 5 deletions library/commandline/src/modules/CommandLine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,7 @@ def Parse(arguments)
Ops.set(givenoptions, o, i)
end
else
ret = if v == ""
false
else
TypeRepository.is_a(v, opttype)
end
ret = (v == "") ? false : TypeRepository.is_a(v, opttype)

if ret != true
# translators: error message, %2 is expected type, %3 is the value given
Expand Down
11 changes: 3 additions & 8 deletions library/network/src/lib/network/susefirewall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -781,15 +781,10 @@ def IsOtherFirewallRunning
Builtins.size(iptables_list)
)

# none iptables rules
any_firewall_running = if Ops.greater_than(Builtins.size(iptables_list), 0)
true
# any iptables rules exist
else
false
end
# error running command
# any iptables rule exist?
any_firewall_running = Ops.greater_than(Builtins.size(iptables_list), 0)
else
# error running command
Builtins.y2error(
"Services Command: %1 (Exit %2) -> %3",
command,
Expand Down
6 changes: 1 addition & 5 deletions library/network/src/modules/CWMFirewallInterfaces.rb
Original file line number Diff line number Diff line change
Expand Up @@ -899,11 +899,7 @@ def OpenFirewallHandle(widget, _key, event)
UI.QueryWidget(Id("_cwm_open_firewall"), :Value)
)
Builtins.y2milestone("OF: %1", value)
@allowed_interfaces = if value
deep_copy(@all_interfaces)
else
[]
end
@allowed_interfaces = value ? deep_copy(@all_interfaces) : []

@buggy_ifaces = []
# Checks whether it's possible to enable or disable the service for all interfaces
Expand Down
1 change: 0 additions & 1 deletion library/packages/src/modules/SignatureCheckDialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ def CheckSignatures
# @return do checking?
def CheckSignaturesInYaST
if @check_signatures.nil?
chs = nil
chs = if Stage.initial
CheckSignatures()
else
Expand Down
6 changes: 1 addition & 5 deletions library/packages/test/dummy_callbacks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ class FakePkg
class << self
def method_missing(_met, *args, &_block)
signature = args.first.signature
args_count = if signature.include?("()")
0
else
signature.count(",") + 1
end
args_count = signature.include?("()") ? 0 : (signature.count(",") + 1)

passed_args = Array.new(args_count, nil)
args.first.call(*passed_args) # try to call method to avoid syntax errors and typos
Expand Down
6 changes: 1 addition & 5 deletions library/system/src/modules/Kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,7 @@ def ExtractCmdlineParameters(line)
else
current_param = Ops.add(current_param, current_char)
end
after_backslash = if current_char == "\\"
true
else
false
end
after_backslash = current_char == "\\"
parse_index = Ops.add(parse_index, 1)
end
cmdlist = Builtins.add(cmdlist, current_param)
Expand Down
6 changes: 1 addition & 5 deletions library/types/src/modules/String.rb
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,7 @@ def ParseOptions(options, parameters)
# start of a string
state = :in_string

str = if character == "\\\""
"\""
else
character
end
str = (character == "\\\"") ? "\"" : character
end
# after double quoted string - handle non-separator chars after double quote
elsif state == :in_quoted_string_after_dblqt
Expand Down

0 comments on commit 364a46f

Please sign in to comment.