Class: Xap::Schema::XapBscBlock
- Inherits:
-
Object
- Object
- Xap::Schema::XapBscBlock
- Defined in:
- lib/xap/schema/xap_bsc.rb
Instance Attribute Summary collapse
-
#display_text ⇒ Object
Returns the value of attribute display_text.
-
#id ⇒ Object
Returns the value of attribute id.
-
#level ⇒ Object
Returns the value of attribute level.
-
#state ⇒ Object
Returns the value of attribute state.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#blockname ⇒ Object
Returns ‘input.state(.nn)’ for input messages, ‘output.state(.nn)’ for output messages.
-
#initialize(is_input, index, hash) ⇒ XapBscBlock
constructor
is_input - Whether this is an input block or an output block index - If not nil, the block’s index (0-based) hash - The block’s hash of key-value pairs from @blocks – this will be modified to.
-
#inspect ⇒ Object
Returns a human-readable string description of this block.
Constructor Details
#initialize(is_input, index, hash) ⇒ XapBscBlock
is_input - Whether this is an input block or an output block index - If not nil, the block’s index (0-based) hash - The block’s hash of key-value pairs from @blocks – this will be modified to
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/xap/schema/xap_bsc.rb', line 16 def initialize is_input, index, hash @is_input = is_input @index = index @hash = hash @hash.clone.each do |k, v| case k.downcase when 'state' @hash.delete k set_state v when 'level' @hash.delete k set_level v when 'text' @hash.delete k self.text = v when 'displaytext' @hash.delete k self.display_text = v when 'id' @hash.delete k self.id = v.upcase end end end |
Instance Attribute Details
#display_text ⇒ Object
Returns the value of attribute display_text.
10 11 12 |
# File 'lib/xap/schema/xap_bsc.rb', line 10 def display_text @display_text end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/xap/schema/xap_bsc.rb', line 10 def id @id end |
#level ⇒ Object
Returns the value of attribute level.
10 11 12 |
# File 'lib/xap/schema/xap_bsc.rb', line 10 def level @level end |
#state ⇒ Object
Returns the value of attribute state.
10 11 12 |
# File 'lib/xap/schema/xap_bsc.rb', line 10 def state @state end |
#text ⇒ Object
Returns the value of attribute text.
10 11 12 |
# File 'lib/xap/schema/xap_bsc.rb', line 10 def text @text end |
Instance Method Details
#blockname ⇒ Object
Returns ‘input.state(.nn)’ for input messages, ‘output.state(.nn)’ for output messages
104 105 106 107 108 |
# File 'lib/xap/schema/xap_bsc.rb', line 104 def blockname s = @is_input ? 'input.state' : 'output.state' s << ".#{@index + 1}" if @index s end |
#inspect ⇒ Object
Returns a human-readable string description of this block.
111 112 113 |
# File 'lib/xap/schema/xap_bsc.rb', line 111 def inspect "Name: #{blockname} ID: #{id} State: #{state} Level: #{level} Text: #{text} DisplayText: #{display_text}" end |