Sha256: ebe748970fa29dbb3267df8962a06c82a9fbe11b5fb0606837cca0ae262c2516

Contents?: true

Size: 426 Bytes

Versions: 1

Compression:

Stored size: 426 Bytes

Contents

module Rats
  class Section < Data

    VALID_SECTIONS = (1..36)

    def self.padding_width; 2; end
    def self.padding_value; "0"; end

    def self.transform(value)
      return unless value
      value.to_i > 0 ? value.to_i : nil
    end

    def fullname
      @value && @value.to_i > 0 ? "Section #{@value}" : ''
    end

    private

    def validate!
      VALID_SECTIONS.include?(self.value.to_i)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rats-0.5.0 lib/rats/data/section.rb