Class: Glaemscribe::API::Sheaf
Constant Summary collapse
- SHEAF_SEPARATOR =
"*"
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
-
#fragments ⇒ Object
readonly
Returns the value of attribute fragments.
-
#linkable ⇒ Object
readonly
Returns the value of attribute linkable.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#sheaf_chain ⇒ Object
readonly
Returns the value of attribute sheaf_chain.
Instance Method Summary collapse
- #dst? ⇒ Boolean
-
#initialize(sheaf_chain, expression, linkable) ⇒ Sheaf
constructor
Should pass a sheaf expression, e.g.
- #p ⇒ Object
- #src? ⇒ Boolean
Constructor Details
#initialize(sheaf_chain, expression, linkable) ⇒ Sheaf
Should pass a sheaf expression, e.g. : “h, s, t”
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/api/sheaf.rb', line 48 def initialize(sheaf_chain, expression, linkable) @linkable = linkable @sheaf_chain = sheaf_chain @mode = sheaf_chain.mode @rule = sheaf_chain.rule @expression = expression # Split members using "*" separator, KEEP NULL MEMBERS (this is legal) fragment_exps = expression.split(SHEAF_SEPARATOR,-1).map{|fragment_exp| fragment_exp.strip } fragment_exps = [""] if fragment_exps.empty? # For NULL # Build the fragments inside @fragments = fragment_exps.map{ |fragment_exp| Fragment.new(self, fragment_exp) } end |
Instance Attribute Details
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
40 41 42 |
# File 'lib/api/sheaf.rb', line 40 def expression @expression end |
#fragments ⇒ Object (readonly)
Returns the value of attribute fragments.
35 36 37 |
# File 'lib/api/sheaf.rb', line 35 def fragments @fragments end |
#linkable ⇒ Object (readonly)
Returns the value of attribute linkable.
34 35 36 |
# File 'lib/api/sheaf.rb', line 34 def linkable @linkable end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
37 38 39 |
# File 'lib/api/sheaf.rb', line 37 def mode @mode end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
38 39 40 |
# File 'lib/api/sheaf.rb', line 38 def rule @rule end |
#sheaf_chain ⇒ Object (readonly)
Returns the value of attribute sheaf_chain.
36 37 38 |
# File 'lib/api/sheaf.rb', line 36 def sheaf_chain @sheaf_chain end |
Instance Method Details
#dst? ⇒ Boolean
45 |
# File 'lib/api/sheaf.rb', line 45 def dst?; @sheaf_chain.dst?; end |
#p ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/api/sheaf.rb', line 64 def p ret = "-- " + @expression + "\n" @fragments.each{ |l| ret += l.p } ret end |
#src? ⇒ Boolean
44 |
# File 'lib/api/sheaf.rb', line 44 def src?; @sheaf_chain.src?; end |