Class: Arstotzka::MethodBuilder Private
- Inherits:
-
Sinclair
- Object
- Sinclair
- Arstotzka::MethodBuilder
- Includes:
- Base
- Defined in:
- lib/arstotzka/method_builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class responsible to orchestrate the addtion of method that will crawl the hash for value
Instance Method Summary collapse
-
#attr_fetcher(attribute) ⇒ String
private
private
Returns the code needed to initialize fetcher.
-
#cached_fetcher(attribute) ⇒ String
private
private
Returns the code needed to initialize a fetche and cache it.
-
#initialize(attr_names, klass, options = {}) ⇒ MethodBuilder
constructor
private
Returns new instance of Arstotzka::MethodBuilder.
Methods included from Base
Constructor Details
#initialize(attr_names, klass, options_hash = {}) ⇒ MethodBuilder #initialize(attr_names, klass, options) ⇒ MethodBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns new instance of Arstotzka::MethodBuilder
56 57 58 59 60 61 62 |
# File 'lib/arstotzka/method_builder.rb', line 56 def initialize(attr_names, klass, = {}) super(klass) self. = @attr_names = attr_names init end |
Instance Method Details
#attr_fetcher(attribute) ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the code needed to initialize fetcher
103 104 105 106 107 108 109 |
# File 'lib/arstotzka/method_builder.rb', line 103 def attr_fetcher(attribute) <<-CODE begin self.class.fetcher_for(:#{attribute}, self).fetch end CODE end |
#cached_fetcher(attribute) ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the code needed to initialize a fetche and cache it
118 119 120 121 122 |
# File 'lib/arstotzka/method_builder.rb', line 118 def cached_fetcher(attribute) <<-CODE @#{attribute} ||= #{attr_fetcher(attribute)} CODE end |