Hello everyone,
I'm currently working on a DSL to express a JSON structure. It is
inspired by rails' jbuilder.
Since it is the first time I work on a DSL, I would like to know if
some of you can take a
look on the code I've made, and tell me what do you think of it.
Here is the class used to understand the DSL : http://pastebin.com/Tv67LGe1
Some exemple of usage of the DSL :
- Case A : http://pastebin.com/ZGKmsGxv
- Case B : http://pastebin.com/7Ce7UBkb
- Case C : http://pastebin.com/yCq0mrPj
- Case D : http://pastebin.com/mRerZnb8
When creating a JsonDSL object, pass the file to parse as a first
parameter and check the content of the `dsl_attributes` variable to
see the result.
Thank you for taking time to take a look on it.
J. Seban.
For your use cases, it would be helpful for my understanding to show the
actual output from the DSL usage.
···
On Tue, Aug 16, 2016 at 5:21 AM Jérémy Seban <jeremy@seban.eu> wrote:
Hello everyone,
I'm currently working on a DSL to express a JSON structure. It is
inspired by rails' jbuilder.
Since it is the first time I work on a DSL, I would like to know if
some of you can take a
look on the code I've made, and tell me what do you think of it.
Here is the class used to understand the DSL :
class JsonDSL attr_reader :dsl_attributes def initialize(to_eval, ev - Pastebin.com
Some exemple of usage of the DSL :
- Case A : # Case A example do hello 'world' foo 'bar' sports %w(basket foot r - Pastebin.com
- Case B : # Case Bmy_array = [ {first_name: 'bar', last_name: 'foo'}]array! p - Pastebin.com
- Case C : # Case Cmy_array = [ {first_name: 'bar', last_name: 'foo'}]array! m - Pastebin.com
- Case D : # Case Dmy_array = [ {first_name: 'bar', last_name: 'foo'}]array! p - Pastebin.com
When creating a JsonDSL object, pass the file to parse as a first
parameter and check the content of the `dsl_attributes` variable to
see the result.
Thank you for taking time to take a look on it.
J. Seban.
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
--
- Raj
Sorry, I wanted to do it, but I forgot when I sent the mail :
Case A : { "example": { "hello": "world", "foo": "bar", "sports": ["basket", " - Pastebin.com
Case B : { "people": [{ "last_name": "foo", "first_name": "bar" }]} - Pastebin.com
Case C : [{"last_name":"foo","first_name":"bar"}] - Pastebin.com
Case D : { "people": [{ "last_name": "foo", "first_name": "bar" }]} - Pastebin.com
···
On Tue, Aug 16, 2016 at 7:08 PM, Raj Sahae <rajsahae@gmail.com> wrote:
For your use cases, it would be helpful for my understanding to show the
actual output from the DSL usage.
On Tue, Aug 16, 2016 at 5:21 AM Jérémy Seban <jeremy@seban.eu> wrote:
Hello everyone,
I'm currently working on a DSL to express a JSON structure. It is
inspired by rails' jbuilder.
Since it is the first time I work on a DSL, I would like to know if
some of you can take a
look on the code I've made, and tell me what do you think of it.
Here is the class used to understand the DSL :
class JsonDSL attr_reader :dsl_attributes def initialize(to_eval, ev - Pastebin.com
Some exemple of usage of the DSL :
- Case A : # Case A example do hello 'world' foo 'bar' sports %w(basket foot r - Pastebin.com
- Case B : # Case Bmy_array = [ {first_name: 'bar', last_name: 'foo'}]array! p - Pastebin.com
- Case C : # Case Cmy_array = [ {first_name: 'bar', last_name: 'foo'}]array! m - Pastebin.com
- Case D : # Case Dmy_array = [ {first_name: 'bar', last_name: 'foo'}]array! p - Pastebin.com
When creating a JsonDSL object, pass the file to parse as a first
parameter and check the content of the `dsl_attributes` variable to
see the result.
Thank you for taking time to take a look on it.
J. Seban.
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
--
- Raj
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>