Class: Qbrick::PublishState

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Translation
Defined in:
app/models/qbrick/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.



12
13
14
# File 'app/models/qbrick/publish_state.rb', line 12

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.



9
10
11
# File 'app/models/qbrick/publish_state.rb', line 9

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

.allObject



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

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