Sha256: 9a30fb15d249e23c22f6bcb0f85bde5c95e613f66882c4350167e7bfc68ad68c

Contents?: true

Size: 513 Bytes

Versions: 2

Compression:

Stored size: 513 Bytes

Contents

module StateObjects
  class Base

    def initialize(model)
      @model = model
    end

    def self.state_object_values(*opts)  # :nodoc:
      class_eval <<-EOF
        def self.symbol
          '#{opts[0]}'.to_sym
        end
        def self.db_value
          '#{opts[1]}'
        end
        def self.where
          "(status_option ='#{opts[1]}')"
        end
        def self.label
          '#{opts[2]}'
        end
      EOF
    end

    protected 
      def model
        @model
      end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
state_objects-0.0.4 lib/state_objects/base.rb
state_objects-0.0.3 lib/state_objects/base.rb