Skip to content

Commit

Permalink
0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mosop committed Jan 19, 2017
1 parent f4d1d32 commit 90e2b10
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: optarg
version: 0.4.2.9
version: 0.5.0

authors:
- mosop
Expand All @@ -9,4 +9,4 @@ license: MIT
dependencies:
callback:
github: mosop/callback
version: 0.5.0.1
version: 0.6.0
4 changes: 3 additions & 1 deletion src/optarg/model.cr
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module Optarg
inherit_callback_group :validate, ::Proc(::{{@type}}, ::Nil)

def data
@data.var.as(::{{@type}})
@data.as(::{{@type}})
end
end

Expand Down Expand Up @@ -135,6 +135,8 @@ module Optarg

def __parsed_nodes; __parser.parsed_nodes; end

def __definitions; self.class.__definitions; end

def [](index : Int32)
__parser.parsed_args[index]
end
Expand Down
6 changes: 3 additions & 3 deletions src/optarg/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Optarg

alias Node = NamedTuple(args: Array(String), definitions: Array(Definitions::Base))

@data = Util::Var(Model).new
getter data : Model

getter parsed_nodes = [] of Node
getter! options : OptionValueContainer?
Expand All @@ -18,7 +18,7 @@ module Optarg
getter index = 0

def initialize(data)
@data.var = data
@data = data
@options = OptionValueContainer.new(self)
@args = ArgumentValueContainer.new(self)
end
Expand All @@ -37,7 +37,7 @@ module Optarg

@definitions : DefinitionSet?
def definitions
@definitions ||= data.class.definitions
@definitions ||= data.__definitions
end

def stopped?
Expand Down
2 changes: 1 addition & 1 deletion src/optarg/version.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Optarg
VERSION = "0.4.2.9"
VERSION = "0.5.0"
end

0 comments on commit 90e2b10

Please sign in to comment.