Class: Archetype

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Serialization
Defined in:
lib/archetype.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, options) ⇒ Archetype

Returns a new instance of Archetype.



8
9
10
11
# File 'lib/archetype.rb', line 8

def initialize(id, options)
  @id = id
  @options = options
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/archetype.rb', line 6

def id
  @id
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/archetype.rb', line 6

def options
  @options
end

Class Method Details



25
26
27
# File 'lib/archetype.rb', line 25

def self.banner
  "banner"
end

.defaultObject



17
18
19
# File 'lib/archetype.rb', line 17

def self.default
  "regular"
end

.listObject



29
30
31
32
# File 'lib/archetype.rb', line 29

def self.list
  return [] unless @archetypes.present?
  @archetypes.values
end

.private_messageObject



21
22
23
# File 'lib/archetype.rb', line 21

def self.private_message
  "private_message"
end

.register(name, options = {}) ⇒ Object



34
35
36
37
# File 'lib/archetype.rb', line 34

def self.register(name, options = {})
  @archetypes ||= {}
  @archetypes[name] = Archetype.new(name, options)
end

Instance Method Details

#attributesObject



13
14
15
# File 'lib/archetype.rb', line 13

def attributes
  { id: @id, options: @options }
end