Sha256: df6cd6e4f6ab1556b209ef36c1895fd6b331574808c89e5016ab63cc0dc856ac

Contents?: true

Size: 389 Bytes

Versions: 7

Compression:

Stored size: 389 Bytes

Contents

# frozen_string_literal: true

require 'date'

Date.class_eval do
  unless method_defined?(:input)
    # @return [String] - yyyy-mm-dd
    def input(_all = false)
      strftime('%F')
    end
  end
end

DateTime.class_eval do
  unless method_defined?(:input)
    # @return [String] - yyyy-mm-dd[Thh:mm::ss]
    def input(all = false)
      strftime(all ? '%F %T' : '%F')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ruby-rails-extensions-0.2.0 lib/ruby-rails-extensions/extensions/input.rb
ruby-rails-extensions-0.2.0.pre.rc.1 lib/ruby-rails-extensions/extensions/input.rb
ruby-rails-extensions-1.1.0 lib/ruby-rails-extensions/extensions/input.rb
ruby-rails-extensions-1.1.0.pre.rc.1 lib/ruby-rails-extensions/extensions/input.rb
ruby-rails-extensions-0.1.0 lib/ruby-rails-extensions/extensions/input.rb
ruby-rails-extensions-1.0.0 lib/ruby-rails-extensions/extensions/input.rb
ruby-rails-extensions-1.0.0.pre.rc.1 lib/ruby-rails-extensions/extensions/input.rb