Last active
August 29, 2015 14:08
-
-
Save kris/9bc061761093acb91df9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Widget | |
# BusinessSearch widget | |
# | |
# Attributes: | |
# | |
# cache - Total seconds to cache the data from this widget | |
# type_list - Types of businesses to search | |
# | |
# Methods: | |
# | |
# #business_types - Get list of Business types to search | |
# | |
class BusinessSearch < Base | |
attr_accessor :type_list | |
validates :type_list, presence: true | |
# Get a list of business class constants | |
# | |
# @return [Array] | |
def business_types | |
safely(Array.new) do | |
Array(type_list).collect do |type| | |
type.to_s.classify.constantize | |
end | |
end | |
end | |
# This doesn't have dynamic content to cache | |
# | |
# @return [Integer] | |
def cache | |
0 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment