Sha256: 5c7d9e2a69166da0df0c24e3074b5fca2a4fc56bc3444fcb898f52a895c64f75

Contents?: true

Size: 662 Bytes

Versions: 13

Compression:

Stored size: 662 Bytes

Contents

module EfoNelfo
  module PropertyTypes
    refine NilClass do
      def to_csv
        nil
      end
    end

    refine TrueClass do
      def to_csv
        'J'
      end
    end

    refine FalseClass do
      def to_csv
        'N'
      end
    end

    refine String do
      def to_csv
        to_s.encode EfoNelfo::Reader::CSV::ENCODING
      end
    end

    refine Date do
      def to_csv
        strftime("%Y%m%d")
      end
    end

    refine Fixnum do
      def to_csv
        to_s
      end
    end

    refine Float do
      def with_decimals(decimals)
        decimals.nil? ? self : self * (1.0/10**decimals.to_i)
      end
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
efo_nelfo-1.7.0 lib/efo_nelfo/property_types.rb
efo_nelfo-1.6.2 lib/efo_nelfo/property_types.rb
efo_nelfo-1.6.1 lib/efo_nelfo/property_types.rb
efo_nelfo-1.6.0 lib/efo_nelfo/property_types.rb
efo_nelfo-1.5.5 lib/efo_nelfo/property_types.rb
efo_nelfo-1.5.4 lib/efo_nelfo/property_types.rb
efo_nelfo-1.5.3 lib/efo_nelfo/property_types.rb
efo_nelfo-1.5.2 lib/efo_nelfo/property_types.rb
efo_nelfo-1.5.1 lib/efo_nelfo/property_types.rb
efo_nelfo-1.5.0 lib/efo_nelfo/property_types.rb
efo_nelfo-1.4.0 lib/efo_nelfo/property_types.rb
efo_nelfo-1.3.2 lib/efo_nelfo/property_types.rb
efo_nelfo-1.3.1 lib/efo_nelfo/property_types.rb