Sha256: 9719480f7390e8c75853c22565d3aed4166c3c2cecfc6eac721fd6839a0ffe58

Contents?: true

Size: 813 Bytes

Versions: 1

Compression:

Stored size: 813 Bytes

Contents

# This class wraps DataWorks::Works and only exposes methods that are
# meant to be public.  The sole purpose of this class is information
# hiding.
module DataWorks
  class Base

    def initialize
      @works = DataWorks::Works.new
    end

    # we expose the public interface here
    def method_missing(method_name, *args, &block)
      method_name = method_name.to_s
      if method_name =~ /\A(add_|the_)(\w+)\Z/ ||
         method_name =~ /\A(\w+)(\d+)\Z/ ||
         method_name =~ /\Aset_(current_default|restriction)\Z/ ||
         method_name =~ /\Aclear_(current_default|restriction)_for\Z/ ||
         method_name == 'visualize'
        @works.send(method_name, *args, &block)
      else
        raise NoMethodError.new("#{method_name} method not found in data works")
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
data_works-0.1.1 lib/data_works/base.rb