Class: RailsBase::RequestLink
- Inherits:
-
Object
- Object
- RailsBase::RequestLink
- Defined in:
- lib/rails_base/request_link.rb
Instance Attribute Summary collapse
-
#link ⇒ Object
Returns the value of attribute link.
-
#text ⇒ Object
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(link:, text:) ⇒ RequestLink
constructor
A new instance of RequestLink.
Constructor Details
#initialize(link:, text:) ⇒ RequestLink
Returns a new instance of RequestLink.
22 23 24 25 |
# File 'lib/rails_base/request_link.rb', line 22 def initialize(link:, text:) @link = link @text = text end |
Instance Attribute Details
#link ⇒ Object
Returns the value of attribute link.
5 6 7 |
# File 'lib/rails_base/request_link.rb', line 5 def link @link end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/rails_base/request_link.rb', line 5 def text @text end |
Class Method Details
.add(link:, text:) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/rails_base/request_link.rb', line 7 def self.add(link:, text:) return false if items.any? { _1.text == text } items << new(link:, text:) true end |
.any? ⇒ Boolean
18 19 20 |
# File 'lib/rails_base/request_link.rb', line 18 def self.any? items.length > 0 end |
.items ⇒ Object
14 15 16 |
# File 'lib/rails_base/request_link.rb', line 14 def self.items @array ||= [] end |