class BerkeleyLibrary::Util::ODS::XML::Style::Family

Public Class Methods

ensure_family(f) click to toggle source
# File lib/berkeley_library/util/ods/xml/style/family.rb, line 47
def ensure_family(f)
  family = f.is_a?(Family) ? f : Family.from_string(f)
  return family if family

  raise ArgumentError, "Not a style family: #{f.inspect}"
end
from_string(str) click to toggle source
# File lib/berkeley_library/util/ods/xml/style/family.rb, line 42
def from_string(str)
  find_by_key(str.to_s.upcase.to_sym) ||
    find_by_value_str(str.to_s.downcase)
end

Public Instance Methods

index_part(style_name) click to toggle source
# File lib/berkeley_library/util/ods/xml/style/family.rb, line 64
def index_part(style_name)
  prefix, suffix = split_name(style_name)
  return unless prefix == self.prefix
  return unless (suffix_i = suffix.to_i).to_s == suffix

  suffix_i
end
prefix() click to toggle source
# File lib/berkeley_library/util/ods/xml/style/family.rb, line 15
def prefix
  'co'
end
split_name(style_name) click to toggle source

Public instance methods

# File lib/berkeley_library/util/ods/xml/style/family.rb, line 58
def split_name(style_name)
  return [nil, style_name] unless style_name.start_with?(prefix)

  [prefix, style_name[prefix.size..]]
end
to_s() click to toggle source

TypesafeEnum overrides

# File lib/berkeley_library/util/ods/xml/style/family.rb, line 75
def to_s
  # noinspection RubyYardReturnMatch
  value
end