Sha256: 861a172415c4fb2353d6fcff0ad6a3145fa69590d9de876b05ece9747ced432c

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

module Ruml
  class List
    attr_reader :config

    def initialize(path)
      @config = Config.new(path)
    end

    def path
      config.path
    end

    def id
      @id ||= to.gsub('@', '.')
    end

    def name
      @name ||= lines("name").first
    end

    def members
      @members ||= lines("members").map(&:downcase).uniq.reject { |member| member =~ /^#|^$/ }
    end

    def to
      @to ||= lines("to").first
    end

    def bounce_to
      @bounce_to ||= lines("bounce_to").first || to
    end

  private

    def lines(name)
      value = config[name]
      value = value.split("\n").map(&:strip) if value.respond_to?(:split)
      value
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruml-1.0.0 lib/ruml/list.rb