Skip to content

Commit

Permalink
Move Attributes Interpretation and delegation to Procedure
Browse files Browse the repository at this point in the history
Schedules are a type of banch procedure with atts, thus extracting this to the parent class Procecure made sense

Related to mantor#58
  • Loading branch information
jfrioux committed Dec 6, 2020
1 parent a117335 commit 94e4662
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 0 additions & 4 deletions app/models/floristry/leaf_procedure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ class LeafProcedure < Procedure
include LeafProcedureMixin

attr_accessor :payload
attr_reader :att, :atts

delegate :att, :atts, :raw_atts, to: :@atts

def initialize(id, name, atts, payload, era)

super

@payload = payload
@atts = Floristry::AttributesInterpreter.new(atts)
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion app/models/floristry/procedure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class Procedure
include Floristry::CommonMixin
include ProcedureMixin

attr_reader :id, :name, :payload, :era
attr_reader :id, :name, :payload, :era, :att, :atts
delegate :att, :atts, :raw_atts, to: :@atts

def initialize(id, name, atts, payload, era)

Expand All @@ -19,6 +20,7 @@ def initialize(id, name, atts, payload, era)
end

@name = name
@atts = Floristry::AttributesInterpreter.new(atts)
@payload = payload
@era = era

Expand Down

0 comments on commit 94e4662

Please sign in to comment.