Class: ConvenientService::Service::Plugins::CanHaveInlineServices::Entities::Proxy Private

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.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.

Since:

  • 1.0.0

Instance Method Summary collapse

Constructor Details

#initialize(chain: {}, &block) ⇒ void

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.

Parameters:

  • chain (Hash{Symbol => Object}) (defaults to: {})
  • block (Proc, nil)

Since:

  • 1.0.0



23
24
25
26
27
28
29
30
31
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 23

def initialize(chain: {}, &block)
  @chain = chain

  if block
    chain[:block] = block

    define
  end
end

Instance Method Details

#==(other) ⇒ Boolean?

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.

Parameters:

  • other (Object) —

    Can be any type.

Returns:

  • (Boolean, nil)

Since:

  • 1.0.0



138
139
140
141
142
143
144
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 138

def ==(other)
  return unless other.instance_of?(self.class)

  return false if chain != other.chain

  true
end

#define ⇒ Boolean

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:

  • (Boolean)

Since:

  • 1.0.0



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 48

def define
  return false if self.defined?

  klass.include config

  variables.each_pair { |key, value| klass.define_method(key) { value } }

  klass.class_exec(arguments, &block)

  mark_as_defined!

  true
end

#defined? ⇒ Boolean

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:

  • (Boolean)

Since:

  • 1.0.0



36
37
38
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 36

def defined?
  chain.has_key?(:defined)
end

#result(&block) ⇒ ConvenientService::Service::Plugins::HasJSendResult::Entities::Result

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.

Parameters:

  • block (Proc, nil)

Returns:

Since:

  • 1.0.0



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 101

def result(&block)
  if block
    assert_not_defined!

    chain[:block] = block

    define
  end

  klass.result
end

#to_class(&block) ⇒ Class<ConvenientService::Service> Also known as: service

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.

Parameters:

  • block (Proc, nil)

Returns:

Since:

  • 1.0.0



117
118
119
120
121
122
123
124
125
126
127
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 117

def to_class(&block)
  if block
    assert_not_defined!

    chain[:block] = block

    define
  end

  klass
end

#with_arguments ⇒ ConvenientService::Service::Plugins::CanHaveInlineServices::Entities::Proxy

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.



65
66
67
68
69
70
71
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 65

def with_arguments(...)
  assert_not_defined!

  chain[:arguments] = Support::Arguments.new(...)

  self
end

#with_config(config) ⇒ ConvenientService::Service::Plugins::CanHaveInlineServices::Entities::Proxy

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.



89
90
91
92
93
94
95
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 89

def with_config(config)
  assert_not_defined!

  chain[:config] = config

  self
end

#with_variables(**variables) ⇒ ConvenientService::Service::Plugins::CanHaveInlineServices::Entities::Proxy

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.

Parameters:

  • variables (Hash{Symbol => Object})

Returns:

Since:

  • 1.0.0



77
78
79
80
81
82
83
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 77

def with_variables(**variables)
  assert_not_defined!

  chain[:variables] = variables

  self
end