Sha256: 3c1490138c794f5deec37c66c37caa54beeb943fffe90904a62584af9313b715

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

module GoogleDataSource
  module DataSource
    class Column
      attr_accessor :type, :id, :label, :pattern

      COLTYPES = %w(boolean number string date datetime timeofday)
      #COLKEYS  = [:type, :id, :label, :pattern]
      
      def initialize(params)
        @type = (params[:type] || :string).to_s
        @id = params[:id].to_sym
        @label = params[:label]
        @pattern = params[:pattern]
      end

      def valid?
        COLTYPES.include?(type)
      end

      def to_h
        {
          :id => id,
          :type => type,
          :label => label,
          :pattern => pattern
        }
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
google_data_source-0.7.6 lib/google_data_source/column.rb