module OpenWebslides::Converter::Content::Properties::Identifier

Attributes

id[RW]

Public Instance Methods

to_h() click to toggle source

Convert property to hash

This is the start of the chain of overridden to_h methods. In all subsequent included property modules, to_h should call `super.merge :property => property`

# File lib/openwebslides/converter/content/properties/identifier.rb, line 21
def to_h
  { :id => id }
end

Private Instance Methods

generate_id() click to toggle source

Generate a random 10-digit alphanumeric identifier

@return [String] identifier

# File lib/openwebslides/converter/content/properties/identifier.rb, line 32
def generate_id
  r = ('a'..'z').to_a + ('0'..'9').to_a

  10.times.map { r.sample }.join
end