Skip to content

Commit

Permalink
Support for an even older version (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonovk committed Feb 12, 2024
1 parent 2aa82ba commit 30fe024
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
activeyaml (1.2.2)
activeyaml (1.2.3)
psych (~> 5.1)

GEM
Expand All @@ -23,7 +23,7 @@ GEM
parser (3.2.2.4)
ast (~> 2.4.1)
racc
psych (5.1.1.1)
psych (5.1.2)
stringio
racc (1.7.3)
rainbow (3.1.1)
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

Framework that allows you to use model classes for mapping Yaml files.

### Installation
## Installation

```ruby
gem 'activeyaml'
```

And then execute:

```bundle install```
Expand All @@ -22,7 +23,8 @@ Require if necessary:
```ruby
require 'active_yaml'
```
### Usage with model

## Usage with model

You can create models that will take data from your Yaml files. Suppose you have the following Yaml file: `examples/example.yaml`. With the following content:

Expand All @@ -34,17 +36,19 @@ start:
users:
first: '1'
```

(This and all subsequent examples will use this yaml file)

Then, you could do the following:

```ruby
require 'active_yaml'
require 'activeyaml'

class User < ActiveYaml::BaseModel
yaml 'examples/example.yaml'
end
```

You can then create instances of your model and use call chains to retrieve data from the Yaml file.

```ruby
Expand Down Expand Up @@ -92,11 +96,12 @@ end
```

After this, you can use class methods to make chains of calls.

```ruby
User.start.kek.lol # output: 'text'
```
With this use case, method `yaml_data` is also supported.

With this use case, method `yaml_data` is also supported.

You also don't have to create models to use this framework. After that, an object will be instantiated in the user variable, allowing chains of calls to be made. To do this you can do the following:

Expand All @@ -105,6 +110,6 @@ user = ActiveYaml.create('examples/example.yaml')
user.start.kek.lol # output: 'text'
```

### Contribution
## Contribution

If you would like to contribute to the development, submit a pull request with your changes. We welcome any contributions that improve the service. You can also view the current project board here. You can also contribute by reporting bugs or suggesting new features. Please use the GitHub issues for that.
2 changes: 1 addition & 1 deletion activeyaml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s.files = Dir.glob('lib/**/*')
s.homepage = 'https://github.com/leonovk/activeyaml'
s.license = 'MIT'
s.required_ruby_version = '>= 2.7'
s.required_ruby_version = '>= 2.4'
s.metadata['homepage_uri'] = s.homepage
s.metadata['source_code_uri'] = s.homepage
s.metadata['documentation_uri'] = s.homepage
Expand Down
3 changes: 3 additions & 0 deletions lib/activeyaml.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require_relative 'active_yaml'

0 comments on commit 30fe024

Please sign in to comment.