narabi 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2012 Technical Group Laboratory, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -6,3 +6,7 @@
6
6
 
7
7
  - Support instance alias
8
8
  - Support title
9
+
10
+ ## Copyright
11
+
12
+ Copyright (c) 2012 Technical Group Laboratory, Inc. See LICENSE for details.
@@ -69,3 +69,12 @@
69
69
  | "instance " | " " |
70
70
  | "instance " | " " |
71
71
 
72
+ シナリオアウトライン: タイトルの解析に成功
73
+ 前提 一行の文字列<入力値>を入力する
74
+ もし 一行のタイトル文字列を解析する
75
+ ならば タイトルは<タイトル>となること
76
+
77
+ 例:
78
+ | 入力値 | タイトル |
79
+ | "title title #1" | "title #1" |
80
+ | "title タイトル #1" | "タイトル #1" |
@@ -50,6 +50,14 @@ end
50
50
  @output = Narabi::Instance.parse_line(@input)
51
51
  end
52
52
 
53
- ならば /^インスタンスは"(.*?)"となること$/ do |expected_name|
53
+ ならば /^インスタンスは"(#{CAPTURE_STRING})"となること$/ do |expected_name|
54
54
  @output[:name].should == expected_name
55
55
  end
56
+
57
+ もし /^一行のタイトル文字列を解析する$/ do
58
+ @output = Narabi::Diagram.parse_line(@input)
59
+ end
60
+
61
+ ならば /^タイトルは"(#{CAPTURE_STRING})"となること$/ do |expected_title|
62
+ @output[:title].should == expected_title
63
+ end
@@ -3,6 +3,7 @@ module Narabi
3
3
  RESPONSE_REGEXP = /^(?<from>.+)-->(?<to>.+):\s?(?<body>.*)/
4
4
  NOTE_REGEXP = /^note\s(?<from>(\s|\b|\d|\w|\W|^:)+):\s?(?<body>.*)/
5
5
  INSTANCE_REGEXP = /^instance\s?(?<name>.+)/
6
+ TITLE_REGEXP = /^title\s(?<title>.+)/
6
7
 
7
8
  class Base
8
9
  def self.try_to_create(regexp, src)
@@ -47,6 +48,12 @@ module Narabi
47
48
  end
48
49
  end
49
50
 
51
+ class Diagram
52
+ def self.parse_line(src)
53
+ msg = Base.try_to_create(TITLE_REGEXP, src)
54
+ end
55
+ end
56
+
50
57
  def self.parse_line(src)
51
58
  if msg = Message.create_return(src)
52
59
  return msg
@@ -1,3 +1,3 @@
1
1
  module Narabi
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: narabi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -53,6 +53,7 @@ files:
53
53
  - .gitignore
54
54
  - .travis.yml
55
55
  - Gemfile
56
+ - LICENSE
56
57
  - README.md
57
58
  - Rakefile
58
59
  - features/parser.feature