Class: Ree::Object

Inherits:
Object show all
Defined in:
lib/ree/core/object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, schema_rpath, rpath) ⇒ Object

Returns a new instance of Object.

Parameters:

  • name (Symbol)

    Object name

  • schema_rpath (String)

    Object schema path relative to project root dir

  • rpath (String)

    Object source file path relative to project root dir



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ree/core/object.rb', line 14

def initialize(name, schema_rpath, rpath)
  @name = name
  @schema_rpath = schema_rpath
  @rpath = rpath
  @links = []
  @errors = []
  @target = :object
  @loaded = false
  @freeze = true
  @compiled = false
  @singleton = false
  @with_caller = false
  @compiled_frozen = @freeze
  @linked_const_list = []
  @tags = []
  @benchmark_config = nil
  @on_link = nil
end

Instance Attribute Details

#after_initObject (readonly)

Returns the value of attribute after_init.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def after_init
  @after_init
end

#benchmark_configObject (readonly)

Returns the value of attribute benchmark_config.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def benchmark_config
  @benchmark_config
end

#class_nameObject (readonly)

Returns the value of attribute class_name.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def class_name
  @class_name
end

#compiled_frozenObject (readonly)

Returns the value of attribute compiled_frozen.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def compiled_frozen
  @compiled_frozen
end

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def errors
  @errors
end

#factoryObject (readonly)

Returns the value of attribute factory.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def factory
  @factory
end

#freezeObject (readonly)

Returns the value of attribute freeze.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def freeze
  @freeze
end

#klassObject (readonly)

Returns the value of attribute klass.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def klass
  @klass
end

#linked_const_listObject (readonly)

Returns the value of attribute linked_const_list.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def linked_const_list
  @linked_const_list
end

Returns the value of attribute links.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def links
  @links
end

#mount_asObject (readonly)

Returns the value of attribute mount_as.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def mount_as
  @mount_as
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def name
  @name
end

Returns the value of attribute on_link.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def on_link
  @on_link
end

#package_nameObject (readonly)

Returns the value of attribute package_name.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def package_name
  @package_name
end

#rpathObject (readonly)

Returns the value of attribute rpath.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def rpath
  @rpath
end

#schema_rpathObject (readonly)

Returns the value of attribute schema_rpath.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def schema_rpath
  @schema_rpath
end

#singletonObject (readonly)

Returns the value of attribute singleton.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def singleton
  @singleton
end

#tagsObject (readonly)

Returns the value of attribute tags.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def tags
  @tags
end

#targetObject (readonly)

Returns the value of attribute target.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def target
  @target
end

#with_callerObject (readonly)

Returns the value of attribute with_caller.



4
5
6
# File 'lib/ree/core/object.rb', line 4

def with_caller
  @with_caller
end

Instance Method Details

#add_const_list(list) ⇒ ArrayOf[String]

Returns All imported constants.

Parameters:

  • list (ArrayOf[String])

    List of imported constants, modules and classes

Returns:

  • (ArrayOf[String])

    All imported constants



51
52
53
54
# File 'lib/ree/core/object.rb', line 51

def add_const_list(list)
  @linked_const_list += list
  @linked_const_list.uniq
end

#add_tags(list) ⇒ Object



169
170
171
172
# File 'lib/ree/core/object.rb', line 169

def add_tags(list)
  @tags += list
  @tags.uniq!
end

#after_init?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/ree/core/object.rb', line 79

def after_init?
  !!@after_init
end

#benchmark?Boolean

Returns:

  • (Boolean)


165
166
167
# File 'lib/ree/core/object.rb', line 165

def benchmark?
  !!@benchmark_config
end

#compiled?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/ree/core/object.rb', line 71

def compiled?
  @compiled
end

#factory?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/ree/core/object.rb', line 75

def factory?
  !!@factory
end

#fn?Boolean

Returns:

  • (Boolean)


127
128
129
# File 'lib/ree/core/object.rb', line 127

def fn?
  @mount_as == :fn
end

#freeze?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/ree/core/object.rb', line 91

def freeze?
  @freeze
end

#loaded?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/ree/core/object.rb', line 87

def loaded?
  @loaded
end

#object?Boolean

Returns:

  • (Boolean)


123
124
125
# File 'lib/ree/core/object.rb', line 123

def object?
  @mount_as == :object
end

#resetObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ree/core/object.rb', line 33

def reset
  @compiled = false
  @singleton = false
  @with_caller = false
  @target = :object
  @loaded = false
  @factory = nil
  @after_init = nil
  @freeze = true
  @links = []
  @errors = []
  @linked_const_list = []
  @benchmark_config = nil
  @on_link = nil
end

#set_after_init(val) ⇒ Object

Parameters:

  • After (Symbol)

    init method name



157
158
159
# File 'lib/ree/core/object.rb', line 157

def set_after_init(val)
  @after_init = val; self
end

#set_as_compiled(frozen) ⇒ Object

Parameters:

  • (Bool)


57
58
59
60
# File 'lib/ree/core/object.rb', line 57

def set_as_compiled(frozen)
  @compiled = true
  @compiled_frozen = frozen
end

#set_as_not_compiledObject



62
63
64
65
# File 'lib/ree/core/object.rb', line 62

def set_as_not_compiled
  @compiled = false
  @compiled_frozen = @freeze
end

#set_as_singletonObject



114
115
116
# File 'lib/ree/core/object.rb', line 114

def set_as_singleton
  @singleton = true; self
end

#set_as_with_callerObject



119
120
121
# File 'lib/ree/core/object.rb', line 119

def set_as_with_caller
  @with_caller = true; self
end

#set_benchmark_config(config) ⇒ Object



161
162
163
# File 'lib/ree/core/object.rb', line 161

def set_benchmark_config(config)
  @benchmark_config = config; self
end

#set_class(klass) ⇒ Object

Parameters:

  • Object (Class)

    class



142
143
144
# File 'lib/ree/core/object.rb', line 142

def set_class(klass)
  @klass = klass; @class_name = klass.to_s; self
end

#set_factory(val) ⇒ Object

Parameters:

  • Factory (Symbol)

    method name



152
153
154
# File 'lib/ree/core/object.rb', line 152

def set_factory(val)
  @factory = val; self
end

#set_freeze(val) ⇒ Object

Parameters:

  • (Bool)


110
111
112
# File 'lib/ree/core/object.rb', line 110

def set_freeze(val)
  @freeze = val; self
end

#set_loadedObject



83
84
85
# File 'lib/ree/core/object.rb', line 83

def set_loaded
  @loaded = true
end

#set_mount_as(val) ⇒ Object

Parameters:

  • val (Symbol)

    Object mount as type (:fn or :bean)



105
106
107
# File 'lib/ree/core/object.rb', line 105

def set_mount_as(val)
  @mount_as = val; self
end

Parameters:

  • block (Proc, nil)


175
176
177
# File 'lib/ree/core/object.rb', line 175

def set_on_link(block)
  @on_link = block
end

#set_package(val) ⇒ Object

Parameters:

  • Package (Symbol)

    name



147
148
149
# File 'lib/ree/core/object.rb', line 147

def set_package(val)
  @package_name = val; self
end

#set_rpath(val) ⇒ Object

Parameters:

  • rpath (String)

    Object source file path relative to project root dir



132
133
134
# File 'lib/ree/core/object.rb', line 132

def set_rpath(val)
  @rpath = val; self
end

#set_schema_rpath(val) ⇒ Object

Parameters:

  • schema_rpath (String)

    Object schema path relative to project root dir



137
138
139
# File 'lib/ree/core/object.rb', line 137

def set_schema_rpath(val)
  @schema_rpath = val; self
end

#set_target(val) ⇒ Object

Parameters:

  • val (Symbol)

    Object linking target (:object, :class, :both)



100
101
102
# File 'lib/ree/core/object.rb', line 100

def set_target(val)
  @target = val; self
end

#singleton?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/ree/core/object.rb', line 95

def singleton?
  @singleton
end

#with_caller?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/ree/core/object.rb', line 67

def with_caller?
  @with_caller
end