Skip to content

Commit

Permalink
Attribute values are in control
Browse files Browse the repository at this point in the history
  • Loading branch information
sbellware committed May 22, 2019
1 parent ee6b8ba commit edda4d4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
12 changes: 12 additions & 0 deletions lib/set_attributes/controls/attribute.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/set_attributes/controls/hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 7 additions & 19 deletions lib/set_attributes/controls/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit edda4d4

Please sign in to comment.