lib/mohawk/accessors/combo.rb in mohawk-0.0.9 vs lib/mohawk/accessors/combo.rb in mohawk-0.1.0

- old
+ new

@@ -5,20 +5,33 @@ def initialize(adapter, locator) @view = adapter.window.select_list(locator) end - def value - @view.value + def set(value) + find(value).select end - def set(value) - @view.select value if value.instance_of? Fixnum - @view.set value if value.instance_of? String + def clear(value) + find(value).clear end + def method_missing(meth, *args, &block) + return super unless @view.respond_to?(meth) + @view.send(meth, *args, &block) + end + def options @view.options.map &:text + end + + def find(what) + case what + when Fixnum + @view.options[what] + when String + @view.option(text: what) + end end end end end