Class: SqlChatbot::Grammar::Entity

Inherits:
Struct
  • Object
show all
Defined in:
lib/sql_chatbot/grammar/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ Entity

Returns a new instance of Entity.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sql_chatbot/grammar/registry.rb', line 11

def initialize(**kwargs)
  super(
    name: kwargs[:name],
    table: kwargs[:table],
    display_label: kwargs[:display_label] || kwargs[:name]&.capitalize,
    row_count: kwargs[:row_count] || 0,
    primary_key: kwargs[:primary_key] || "id",
    timestamps: kwargs[:timestamps] || {},
    fields: kwargs[:fields] || {},
    scopes: kwargs[:scopes] || {},
    associations: kwargs[:associations] || {},
    ranking_candidates: kwargs[:ranking_candidates] || [],
    implicit_filters: kwargs[:implicit_filters] || []
  )
end

Instance Attribute Details

#associationsObject

Returns the value of attribute associations

Returns:

  • (Object)

    the current value of associations



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def associations
  @associations
end

#display_labelObject

Returns the value of attribute display_label

Returns:

  • (Object)

    the current value of display_label



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def display_label
  @display_label
end

#fieldsObject

Returns the value of attribute fields

Returns:

  • (Object)

    the current value of fields



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def fields
  @fields
end

#implicit_filtersObject

Returns the value of attribute implicit_filters

Returns:

  • (Object)

    the current value of implicit_filters



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def implicit_filters
  @implicit_filters
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def name
  @name
end

#primary_keyObject

Returns the value of attribute primary_key

Returns:

  • (Object)

    the current value of primary_key



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def primary_key
  @primary_key
end

#ranking_candidatesObject

Returns the value of attribute ranking_candidates

Returns:

  • (Object)

    the current value of ranking_candidates



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def ranking_candidates
  @ranking_candidates
end

#row_countObject

Returns the value of attribute row_count

Returns:

  • (Object)

    the current value of row_count



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def row_count
  @row_count
end

#scopesObject

Returns the value of attribute scopes

Returns:

  • (Object)

    the current value of scopes



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def scopes
  @scopes
end

#tableObject

Returns the value of attribute table

Returns:

  • (Object)

    the current value of table



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def table
  @table
end

#timestampsObject

Returns the value of attribute timestamps

Returns:

  • (Object)

    the current value of timestamps



7
8
9
# File 'lib/sql_chatbot/grammar/registry.rb', line 7

def timestamps
  @timestamps
end