Class: RbsActivesupport::Delegate
- Inherits:
-
Object
- Object
- RbsActivesupport::Delegate
- Defined in:
- lib/rbs_activesupport/delegate.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
: Symbol.
-
#namespace ⇒ Object
readonly
: RBS::Namespace.
-
#options ⇒ Object
readonly
: Hash[Symbol, untyped].
Instance Method Summary collapse
-
#initialize(namespace, method, options) ⇒ Delegate
constructor
A new instance of Delegate.
-
#method_name ⇒ Object
: Symbol.
-
#private? ⇒ Boolean
: bool.
-
#public? ⇒ Boolean
: bool.
-
#to ⇒ Object
: Symbol.
Constructor Details
#initialize(namespace, method, options) ⇒ Delegate
Returns a new instance of Delegate.
12 13 14 15 16 |
# File 'lib/rbs_activesupport/delegate.rb', line 12 def initialize(namespace, method, ) #: void @namespace = namespace @method = method = end |
Instance Attribute Details
#method ⇒ Object (readonly)
: Symbol
6 7 8 |
# File 'lib/rbs_activesupport/delegate.rb', line 6 def method @method end |
#namespace ⇒ Object (readonly)
: RBS::Namespace
5 6 7 |
# File 'lib/rbs_activesupport/delegate.rb', line 5 def namespace @namespace end |
#options ⇒ Object (readonly)
: Hash[Symbol, untyped]
7 8 9 |
# File 'lib/rbs_activesupport/delegate.rb', line 7 def end |
Instance Method Details
#method_name ⇒ Object
: Symbol
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rbs_activesupport/delegate.rb', line 22 def method_name #: Symbol case [:prefix] when true :"#{to}_#{method}" when String, Symbol :"#{options[:prefix]}_#{method}" else method end end |
#private? ⇒ Boolean
: bool
37 38 39 |
# File 'lib/rbs_activesupport/delegate.rb', line 37 def private? #: bool .fetch(:private, false) end |
#public? ⇒ Boolean
: bool
33 34 35 |
# File 'lib/rbs_activesupport/delegate.rb', line 33 def public? #: bool !private? end |
#to ⇒ Object
: Symbol
18 19 20 |
# File 'lib/rbs_activesupport/delegate.rb', line 18 def to #: Symbol [:to] end |