# lib/stair_master/conditions/base.rb ## ## ## module StairMaster module Conditions class Base attr_reader :type # :if || :unless attr_accessor :method_name def initialize(step, type, method_name) @step = step @type = type @method_name = method_name end ## Methods ------------------------------------------ def available? raise NotImplmenetedError end def not_available? raise NotImplmenetedError end def description raise NotImplementedError end def test(context) case @type.to_sym when :if return context.send(@method_name.to_sym) when :unless return !context.send(@method_name.to_sym) else return false end end end end end