Sha256: e30ee3f319883515d496a08e8d3ef1e2f35ddf2875f0282c947575269f6e1923

Contents?: true

Size: 658 Bytes

Versions: 4

Compression:

Stored size: 658 Bytes

Contents

module Kuhsaft
  class PublishState
    
    extend ActiveModel::Translation
    
    UNPUBLISHED = 0
    PUBLISHED = 1
    PUBLISHED_AT = 2
    
    attr_reader :name
    attr_reader :value
    
    def initialize options
      options.each_pair { |k,v| instance_variable_set("@#{k}", v) if respond_to?(k) }
    end
    
    def human_name
      I18n.translate(name)
    end
    
    def self.all
      @all ||= [
        PublishState.new(:name => 'unpublished', :value => UNPUBLISHED),
        PublishState.new(:name => 'published', :value => PUBLISHED),
        PublishState.new(:name => 'published_at', :value => PUBLISHED_AT)
        ]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kuhsaft-0.1.1 app/models/kuhsaft/publish_state.rb
kuhsaft-0.1.0 app/models/kuhsaft/publish_state.rb
kuhsaft-0.0.8 app/models/kuhsaft/publish_state.rb
kuhsaft-0.0.7 app/models/kuhsaft/publish_state.rb