Class: Kuhsaft::PublishState

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Translation
Defined in:
app/models/kuhsaft/publish_state.rb

Constant Summary collapse

UNPUBLISHED =
0
PUBLISHED =
1
PUBLISHED_AT =
2

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ PublishState

Returns a new instance of PublishState.



13
14
15
# File 'app/models/kuhsaft/publish_state.rb', line 13

def initialize options
  options.each_pair { |k,v| instance_variable_set("@#{k}", v) if respond_to?(k) }
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'app/models/kuhsaft/publish_state.rb', line 10

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



11
12
13
# File 'app/models/kuhsaft/publish_state.rb', line 11

def value
  @value
end

Class Method Details

.allObject



17
18
19
20
21
22
23
# File 'app/models/kuhsaft/publish_state.rb', line 17

def self.all
  @all ||= [
    PublishState.new(:name => 'published', :value => PUBLISHED),
    PublishState.new(:name => 'unpublished', :value => UNPUBLISHED),
    PublishState.new(:name => 'published_at', :value => PUBLISHED_AT)
    ]
end