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



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

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 = []
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

#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

#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



46
47
48
49
# File 'lib/ree/core/object.rb', line 46

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

#add_tags(list) ⇒ Object



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

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

#after_init?Boolean

Returns:

  • (Boolean)


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

def after_init?
  !!@after_init
end

#compiled?Boolean

Returns:

  • (Boolean)


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

def compiled?
  @compiled
end

#factory?Boolean

Returns:

  • (Boolean)


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

def factory?
  !!@factory
end

#fn?Boolean

Returns:

  • (Boolean)


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

def fn?
  @mount_as == :fn
end

#freeze?Boolean

Returns:

  • (Boolean)


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

def freeze?
  @freeze
end

#loaded?Boolean

Returns:

  • (Boolean)


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

def loaded?
  @loaded
end

#object?Boolean

Returns:

  • (Boolean)


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

def object?
  @mount_as == :object
end

#resetObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ree/core/object.rb', line 30

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 = []
end

#set_after_init(val) ⇒ Object

Parameters:

  • After (Symbol)

    init method name



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

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

#set_as_compiled(frozen) ⇒ Object

Parameters:

  • (Bool)


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

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

#set_as_not_compiledObject



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

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

#set_as_singletonObject



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

def set_as_singleton
  @singleton = true; self
end

#set_as_with_callerObject



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

def set_as_with_caller
  @with_caller = true; self
end

#set_class(klass) ⇒ Object

Parameters:

  • Object (Class)

    class



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

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

#set_factory(val) ⇒ Object

Parameters:

  • Factory (Symbol)

    method name



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

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

#set_freeze(val) ⇒ Object

Parameters:

  • (Bool)


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

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

#set_loadedObject



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

def set_loaded
  @loaded = true
end

#set_mount_as(val) ⇒ Object

Parameters:

  • val (Symbol)

    Object mount as type (:fn or :bean)



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

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

#set_package(val) ⇒ Object

Parameters:

  • Package (Symbol)

    name



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

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



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

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



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

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

#set_target(val) ⇒ Object

Parameters:

  • val (Symbol)

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



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

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

#singleton?Boolean

Returns:

  • (Boolean)


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

def singleton?
  @singleton
end

#with_caller?Boolean

Returns:

  • (Boolean)


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

def with_caller?
  @with_caller
end