Class: KDomain::DomainModel::RailsModel

Inherits:
Object
  • Object
show all
Defined in:
lib/k_domain/schemas/domain/old/rails_model.rb

Overview

Rails model represents information that is found the model.rb class in the rails project

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRailsModel

Returns a new instance of RailsModel.



53
54
55
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 53

def initialize
  @quirks = []
end

Instance Attribute Details

#default_scopeObject

Returns the value of attribute default_scope.



30
31
32
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 30

def default_scope
  @default_scope
end

#documentation_rel_pathObject

Returns the value of attribute documentation_rel_path.



10
11
12
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 10

def documentation_rel_path
  @documentation_rel_path
end

#forceObject

Returns the value of attribute force.



19
20
21
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 19

def force
  @force
end

#idObject

Parameters:

  • value (Symbol)

    The value of ID has different meanings



17
18
19
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 17

def id
  @id
end

#model_pathObject

Returns the value of attribute model_path.



11
12
13
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 11

def model_path
  @model_path
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 7

def name
  @name
end

#name_originalObject

Returns the value of attribute name_original.



9
10
11
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 9

def name_original
  @name_original
end

#name_pluralObject

Returns the value of attribute name_plural.



8
9
10
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 8

def name_plural
  @name_plural
end

#primary_keyObject

Returns the value of attribute primary_key.



20
21
22
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 20

def primary_key
  @primary_key
end

#private_instance_methodsObject

Returns the value of attribute private_instance_methods.



34
35
36
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 34

def private_instance_methods
  @private_instance_methods
end

#public_class_methodsObject

Returns the value of attribute public_class_methods.



32
33
34
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 32

def public_class_methods
  @public_class_methods
end

#public_instance_methodsObject

Returns the value of attribute public_instance_methods.



33
34
35
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 33

def public_instance_methods
  @public_instance_methods
end

#quirksObject

Returns the value of attribute quirks.



21
22
23
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 21

def quirks
  @quirks
end

#ruby_codeObject

Returns the value of attribute ruby_code.



24
25
26
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 24

def ruby_code
  @ruby_code
end

#ruby_code_privateObject

Returns the value of attribute ruby_code_private.



28
29
30
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 28

def ruby_code_private
  @ruby_code_private
end

#ruby_code_publicObject

Returns the value of attribute ruby_code_public.



27
28
29
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 27

def ruby_code_public
  @ruby_code_public
end

#ruby_frozenObject

Returns the value of attribute ruby_frozen.



25
26
27
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 25

def ruby_frozen
  @ruby_frozen
end

#ruby_headerObject

Returns the value of attribute ruby_header.



26
27
28
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 26

def ruby_header
  @ruby_header
end

#ruby_rawObject

Returns the value of attribute ruby_raw.



23
24
25
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 23

def ruby_raw
  @ruby_raw
end

#scopesObject

Returns the value of attribute scopes.



31
32
33
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 31

def scopes
  @scopes
end

#time_stamp1Object

stats



37
38
39
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 37

def time_stamp1
  @time_stamp1
end

#time_stamp2Object

Returns the value of attribute time_stamp2.



38
39
40
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 38

def time_stamp2
  @time_stamp2
end

#time_stamp3Object

Returns the value of attribute time_stamp3.



39
40
41
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 39

def time_stamp3
  @time_stamp3
end

Instance Method Details

#add_quirk(quirk) ⇒ Object



57
58
59
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 57

def add_quirk(quirk)
  @quirks << quirk
end

#code_lengthObject



41
42
43
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 41

def code_length
  ruby_raw&.length
end

#display_quirksObject



45
46
47
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 45

def display_quirks
  quirks.join(' ')
end

#exists?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 49

def exists?
  File.exist?(model_path)
end

#to_hObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/k_domain/schemas/domain/old/rails_model.rb', line 61

def to_h
  {
    name: name,
    name_plural: name_plural,
    name_original: name_original,
    documentation_rel_path: documentation_rel_path,
    model_path: model_path,
    id: id,
    force: force,
    primary_key: primary_key,
    quirks: quirks,
    ruby_raw: ruby_raw,
    ruby_code: ruby_code,
    ruby_frozen: ruby_frozen,
    ruby_header: ruby_header,
    ruby_code_public: ruby_code_public,
    ruby_code_private: ruby_code_private,
    default_scope: default_scope,
    scopes: scopes,
    public_class_methods: public_class_methods,
    public_instance_methods: public_instance_methods,
    private_instance_methods: private_instance_methods,
    time_stamp1: time_stamp1,
    time_stamp2: time_stamp2,
    time_stamp3: time_stamp3,
    code_length: code_length,
    exists: exists?
  }
end