Class: RailsMcp::SchemaConfig
- Inherits:
-
Object
- Object
- RailsMcp::SchemaConfig
- Defined in:
- lib/rails_mcp/schema_config.rb
Defined Under Namespace
Classes: Error
Instance Method Summary collapse
- #accessible?(model_name) ⇒ Boolean
-
#allowed_columns(model_name) ⇒ Object
Returns the column allowlist for a model, or [] if model is not in schema.
-
#initialize(path) ⇒ SchemaConfig
constructor
A new instance of SchemaConfig.
- #model_names ⇒ Object
Constructor Details
#initialize(path) ⇒ SchemaConfig
Returns a new instance of SchemaConfig.
9 10 11 12 |
# File 'lib/rails_mcp/schema_config.rb', line 9 def initialize(path) @path = path.to_s @data = load_yaml! end |
Instance Method Details
#accessible?(model_name) ⇒ Boolean
14 15 16 |
# File 'lib/rails_mcp/schema_config.rb', line 14 def accessible?(model_name) @data.key?(model_name.to_s) end |
#allowed_columns(model_name) ⇒ Object
Returns the column allowlist for a model, or [] if model is not in schema.
23 24 25 |
# File 'lib/rails_mcp/schema_config.rb', line 23 def allowed_columns(model_name) Array(@data[model_name.to_s]).map(&:to_s) end |
#model_names ⇒ Object
18 19 20 |
# File 'lib/rails_mcp/schema_config.rb', line 18 def model_names @data.keys end |