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



133
134
135
136
137
138
139
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 133

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

  return false if chain != other.chain

  true
end

#defineBoolean

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



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 43

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



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 96

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



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 112

def to_class(&block)
  if block
    assert_not_defined!

    chain[:block] = block

    define
  end

  klass
end

#with_argumentsConvenientService::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.



60
61
62
63
64
65
66
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 60

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.



84
85
86
87
88
89
90
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 84

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



72
73
74
75
76
77
78
# File 'lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb', line 72

def with_variables(**variables)
  assert_not_defined!

  chain[:variables] = variables

  self
end