Class: ROM::Factory::Attributes::Callable Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/factory/attributes/callable.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.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, dsl, block) ⇒ Callable

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 a new instance of Callable.

API:

  • private



10
11
12
13
14
# File 'lib/rom/factory/attributes/callable.rb', line 10

def initialize(name, dsl, block)
  @name = name
  @dsl = dsl
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

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.

API:

  • private



7
8
9
# File 'lib/rom/factory/attributes/callable.rb', line 7

def block
  @block
end

#dslObject (readonly)

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.

API:

  • private



7
8
9
# File 'lib/rom/factory/attributes/callable.rb', line 7

def dsl
  @dsl
end

#nameObject (readonly)

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.

API:

  • private



7
8
9
# File 'lib/rom/factory/attributes/callable.rb', line 7

def name
  @name
end

Instance Method Details

#call(attrs, *args) ⇒ Object

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.

API:

  • private



17
18
19
20
# File 'lib/rom/factory/attributes/callable.rb', line 17

def call(attrs, *args)
  result = attrs[name] || dsl.instance_exec(*args, &block)
  {name => result}
end

#dependency_namesObject

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.

API:

  • private



28
29
30
# File 'lib/rom/factory/attributes/callable.rb', line 28

def dependency_names
  block.parameters.map(&:last)
end

#inspectObject Also known as: to_s

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.

API:

  • private



33
34
35
# File 'lib/rom/factory/attributes/callable.rb', line 33

def inspect
  "#<#{self.class.name} #{name} at #{block.source_location.join(":")}>"
end

#value?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:

API:

  • private



23
24
25
# File 'lib/rom/factory/attributes/callable.rb', line 23

def value?
  true
end