Skip to content

Commit

Permalink
Version 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mantas Norvaiša committed May 16, 2015
1 parent e3214de commit 5822000
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in to_lua.gemspec
gemspec

gem 'rake'
gem 'rspec', '~> 3.2.0'
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
to_lua (0.1.1)
to_lua (0.2.0)

GEM
remote: https://rubygems.org/
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Or install it manually with:
## Usage

```ruby
{a: 'hash'}.to_lua # {["a"]="hash"}
{a: 'hash'}.to_lua # {a="hash"}
[:some, :array].to_lua # {"some","array"}
"\nStr\"ing\x00".to_lua # "\nStr\"ing\0"
123456.to_lua # 123456
Expand All @@ -40,9 +40,9 @@ nil.to_lua # nil
{a: 'hash', with: {a_nested: 'hash'}}.to_lua(pretty: true)

# {
# ["a"] = "hash",
# ["with"] = {
# ["a_nested"] = "hash"
# a = "hash",
# with = {
# a_nested = "hash"
# }
# }

Expand All @@ -54,9 +54,9 @@ nil.to_lua # nil
{a: 'hash', with: {a_nested: 'hash'}}.to_lua(pretty: true, indent: '')

# {
# ["a"] = "hash",
# ["with"] = {
# ["a_nested"] = "hash"
# a = "hash",
# with = {
# a_nested = "hash"
# }
# }
```
Expand All @@ -73,7 +73,7 @@ class CustomObject
end
end

CustomObject.new.to_lua # {["lua"]="object"}
CustomObject.new.to_lua # {lua="object"}
```

If an object does not define the `as_lua` method, `to_s` will be used instead
Expand Down
6 changes: 3 additions & 3 deletions spec/helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@
it 'returns true if the identifier both has valid characters and is not a reserved keyword' do
allow(ToLua::Helpers).to receive(:valid_identifier_characters?).and_return(true)
allow(ToLua::Helpers).to receive(:reserved_keyword?).and_return(false)

expect(ToLua::Helpers.valid_identifier?('test_identifier')).to be true
end

it 'returns false if the identifier has invalid characters' do
allow(ToLua::Helpers).to receive(:valid_identifier_characters?).and_return(false)
allow(ToLua::Helpers).to receive(:reserved_keyword?).and_return(false)

expect(ToLua::Helpers.valid_identifier?('test_identifier')).to be false
end

it 'returns false if the identifier is a reserved keyword' do
allow(ToLua::Helpers).to receive(:valid_identifier_characters?).and_return(true)
allow(ToLua::Helpers).to receive(:reserved_keyword?).and_return(true)

expect(ToLua::Helpers.valid_identifier?('test_identifier')).to be false
end
end
Expand Down
11 changes: 8 additions & 3 deletions to_lua.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |s|
s.name = 'to_lua'
s.version = '0.1.1'
s.date = '2015-05-14'
s.summary = 'Serialize objects to lua tables'
s.version = '0.2.0'
s.date = Date.today.to_s
s.summary = 'Serialize Ruby objects to lua tables'
s.authors = ['Mantas Norvaiša']
s.email = '[email protected]'
s.homepage = 'https://github.com/mntnorv/to_lua'
s.license = 'MIT'

s.files = Dir['lib/**/*']

s.required_ruby_version = '>= 2.0.0'

s.add_development_dependency('rake')
s.add_development_dependency('rspec', ['~> 3.2.0'])
end

0 comments on commit 5822000

Please sign in to comment.