The whole class looks like this:
class Action
attr_reader :attributes
def initialize(params)
@attributes = params
end
def title
@title = attributes['title']
end
def description
@description = attributes['description']
end
def reference_name
@reference_name = attributes['reference_name']
end
def action_key
@action_key = attributes['action_key']
end
end
The initialize method sets up the class by just creating a hash that is the attributes hash and then the rest of the methods are just pulling out specific pieces from that hash. I’m not sure if by the end of this project, this class will be separate, but to me, it felt like it was doing different stuff than the ActionFetch class so I chose to separate it out.
No comments:
Post a Comment