From edda4d473734b56b836fedec7e73cfa38de7139b Mon Sep 17 00:00:00 2001 From: Scott Bellware Date: Wed, 22 May 2019 19:44:47 -0400 Subject: [PATCH] Attribute values are in control --- lib/set_attributes/controls/attribute.rb | 12 +++++++++++ lib/set_attributes/controls/hash.rb | 4 ++-- lib/set_attributes/controls/object.rb | 26 +++++++----------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/set_attributes/controls/attribute.rb b/lib/set_attributes/controls/attribute.rb index d8717f8..0fc5ca5 100644 --- a/lib/set_attributes/controls/attribute.rb +++ b/lib/set_attributes/controls/attribute.rb @@ -1,6 +1,18 @@ class SetAttributes module Controls module Attribute + def self.some_attribute + 'some value' + end + + def self.some_other_attribute + 'some other value' + end + + def self.yet_another_attribute + 'yet another value' + end + module Random def self.example "x#{SecureRandom.hex}".to_sym diff --git a/lib/set_attributes/controls/hash.rb b/lib/set_attributes/controls/hash.rb index 0bb931f..c43afb4 100644 --- a/lib/set_attributes/controls/hash.rb +++ b/lib/set_attributes/controls/hash.rb @@ -22,8 +22,8 @@ def self.example module Mapped def self.example { - :an_attribute => Object.some_attribute, - :some_other_attribute => Object.some_other_attribute + :an_attribute => Attribute.some_attribute, + :some_other_attribute => Attribute.some_other_attribute } end end diff --git a/lib/set_attributes/controls/object.rb b/lib/set_attributes/controls/object.rb index b69f4d3..b9dfd00 100644 --- a/lib/set_attributes/controls/object.rb +++ b/lib/set_attributes/controls/object.rb @@ -4,25 +4,13 @@ module Object def self.example example = Example.new - example.some_attribute = some_attribute - example.some_other_attribute = some_other_attribute - example.yet_another_attribute = yet_another_attribute + example.some_attribute = Attribute.some_attribute + example.some_other_attribute = Attribute.some_other_attribute + example.yet_another_attribute = Attribute.yet_another_attribute example end - def self.some_attribute - 'some value' - end - - def self.some_other_attribute - 'some other value' - end - - def self.yet_another_attribute - 'yet another value' - end - class Example attr_accessor :some_attribute attr_accessor :some_other_attribute @@ -39,8 +27,8 @@ module MissingAttribute def self.example example = Example.new - example.some_attribute = Object.some_attribute - example.some_other_attribute = Object.some_other_attribute + example.some_attribute = Attribute.some_attribute + example.some_other_attribute = Attribute.some_other_attribute example end @@ -55,8 +43,8 @@ module Mapped def self.example example = Example.new - example.an_attribute = Object.some_attribute - example.some_other_attribute = Object.some_other_attribute + example.an_attribute = Attribute.some_attribute + example.some_other_attribute = Attribute.some_other_attribute example end