Sha256: 0aa3dca65a6be254d6a2537f95b7256cdee885fb047d91b5defda0d1f3dadf30

Contents?: true

Size: 450 Bytes

Versions: 4

Compression:

Stored size: 450 Bytes

Contents

module Skr

    class GlPeriod < Skr::Model

        is_immutable

        def self.current
            attr = { year: Time.now.year, period: Time.now.month }
            GlPeriod.where( attr ).first || GlPeriod.create( attr )
        end

        def self.is_date_locked?( date )
            date && GlPeriod.select(:is_locked).where(
                year: date.year, period: date.month, is_locked: true
            ).first
        end
    end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stockor-0.5.0 lib/skr/models/gl_period.rb
stockor-0.4.0 lib/skr/models/gl_period.rb
stockor-0.3.0 lib/skr/models/gl_period.rb
stockor-0.2 lib/skr/models/gl_period.rb