Skip to content

Commit

Permalink
reduce number of unsupported methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed May 30, 2017
1 parent 05e7f97 commit 1719a19
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions library/cwm/src/lib/cwm/widget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,16 @@ def validate_wrapper(_widget_id, _event)
# Wrapper when combination of old hash based CWM definition needed to be used
# with new object based one. Useful e.g. when content is provided by other
# module like CWMFirewallInterfaces.CreateOpenFirewallWidget
# @note it does not support common methods and helpers from abstract widget
# @note it does not support some of common methods and helpers from abstract widget
#
# @example how to initialize object from firewall interface
# ::CWM::WrapperWidget.new("firewall",
# CWMFirewallInterfaces.CreateOpenFirewallWidget("services" => ["service:sshd", "service:ntp"])
# )
class WrapperWidget < AbstractWidget
# Creates new instance with specified id and content
# @param widget_id [String] name of widget used as identified, have to be unique
# @param widget_id [String] name of widget used as identified, have to be unique.
# It have to be same as real widget id in content, otherwise enable/disable won't work.
# @param content [Hash<String, Object>] CWM hash definition
def initialize(widget_id, content)
self.widget_id = widget_id
Expand All @@ -282,32 +283,18 @@ def cwm_definition
end

def handle_all_events
unsupported
@content["handle_events"].nil?
end

# not supported
# @raise [RuntimeError] always when called
def handle_all_events=(_arg)
unsupported
end

def self.widget_type=(_arg)
raise "Not supported for WrapperWidget"
end

def enabled?
unsupported
end

def enable
unsupported
end

def disable
unsupported
end

private

def unsupported
# not supported
# @raise [RuntimeError] always when called
def self.widget_type=(_arg)
raise "Not supported for WrapperWidget"
end
end
Expand Down

0 comments on commit 1719a19

Please sign in to comment.