Sha256: 7f89466cab4a6c60d2712b3a76f129e1ebd69a85228c4fab41a7494a4654559f
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module GetYourRep # Office information. Belongs to Representative. class OfficeLocation include GetYourRep::Errors include GetYourRep::Associations # Each instance belongs to a Represenative, which has many OfficeLocations. attr_accessor :rep # Defines the type of office ('district' or 'capitol') attr_accessor :type # Line 1 of address. attr_accessor :line_1 # Line 2 of address. attr_accessor :line_2 # City, state and zip. attr_accessor :city, :state, :zip # Office phone attr_accessor :phone # Construct a new instance, setting attributes from an options hash. def initialize(office_hash = {}) office_hash.each do |key, val| send("#{key}=", val) end end # Display self attributes for CLI. def cli_display puts " #{type.capitalize} Office".bold.blue office_lines = [line_1, line_2, "#{city}, #{state} #{zip}"] office_lines.each { |line| puts " #{line}".red if line } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
get_your_rep-1.2.0 | lib/get_your_rep/office_location.rb |