Sha256: 5b49db01d223141a383b95c101b0c106d93584e413ae79c8eadaf9f7010e4078
Contents?: true
Size: 1.04 KB
Versions: 16
Compression:
Stored size: 1.04 KB
Contents
require 'ascii_binder/helpers' include AsciiBinder::Helpers module AsciiBinder class Site attr_reader :id, :name, :url def initialize(distro_config) @id = distro_config['site'] @name = distro_config['site_name'] @url = distro_config['site_url'] end def is_valid? validate end def errors validate(true) end private def validate(verbose=false) errors = [] unless valid_id?(@id) if verbose errors << "Site ID '#{@id}' is not a valid ID." else return false end end unless valid_string?(@name) if verbose errors << "Site name '#{@name}' for site ID '#{@id}' is not a valid string." else return false end end unless valid_string?(@url) if verbose errors << "Site URL '#{@url}' for site ID '#{@id}' is not a valid string." else return false end end return errors if verbose return true end end end
Version data entries
16 entries across 16 versions & 1 rubygems