Module: Indieweb::PostTypes::Configuration

Included in:
Indieweb::PostTypes
Defined in:
lib/indieweb/post_types/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#identifiersObject

Returns the value of attribute identifiers.



16
17
18
# File 'lib/indieweb/post_types/configuration.rb', line 16

def identifiers
  @identifiers
end

#loggerObject

Returns the value of attribute logger.



15
16
17
# File 'lib/indieweb/post_types/configuration.rb', line 15

def logger
  @logger
end

Class Method Details

.extended(base) ⇒ Object



26
27
28
# File 'lib/indieweb/post_types/configuration.rb', line 26

def self.extended(base)
  base.set_default_configuration
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



18
19
20
# File 'lib/indieweb/post_types/configuration.rb', line 18

def configure
  yield self
end

#default_identifiersObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/indieweb/post_types/configuration.rb', line 30

def default_identifiers
  [
    Indieweb::PostTypes::Identifier::Rsvp,
    Indieweb::PostTypes::Identifier::Reply,
    Indieweb::PostTypes::Identifier::Repost,
    Indieweb::PostTypes::Identifier::Like,
    Indieweb::PostTypes::Identifier::Video,
    Indieweb::PostTypes::Identifier::Photo,
    Indieweb::PostTypes::Identifier::Article,
    Indieweb::PostTypes::Identifier::Note
  ]
end

#insert_identifier(klass:, before:) ⇒ Object

TODO: Stop a class being inserted twice?



44
45
46
47
# File 'lib/indieweb/post_types/configuration.rb', line 44

def insert_identifier(klass:, before:)
  raise unless identifiers.include?(before)
  identifiers.insert(identifiers.index(before), klass)
end

#reset_configuration!Object



22
23
24
# File 'lib/indieweb/post_types/configuration.rb', line 22

def reset_configuration!
  set_default_configuration
end

#set_default_configurationObject



49
50
51
52
# File 'lib/indieweb/post_types/configuration.rb', line 49

def set_default_configuration
  self.logger = default_logger
  self.identifiers = default_identifiers
end